Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor GHA workflows (reuse code) #394

Open
Vadorequest opened this issue Feb 25, 2023 · 3 comments
Open

Refactor GHA workflows (reuse code) #394

Vadorequest opened this issue Feb 25, 2023 · 3 comments

Comments

@Vadorequest
Copy link
Member

Is your feature request related to a problem? Please describe.
Some code is duplicated in the GHA workflows because we don't know how to reuse it.

Describe the solution you'd like
See if actions/starter-workflows#245 (comment) could yield better solutions.

@dxs0323
Copy link

dxs0323 commented Feb 14, 2024

Maybe it would be a good start to add general property "import" or "include" and possibly enable it to be either array or single value.

For instance:
import: - some-file.yaml - some-other-file.yaml

or import: some-file.yaml

The logic behind should probably be equal to grabbing content and adding it to same level where the import is. I was also thinking to add possibility to include env files, but that should probably be separate property like "env-import".

for instance:

build:
  (...)
  import-env: ./some-file.env
  env:
    ENV-1: env-value
  (...)
  steps:
    - import: ./some-file-with-steps.yaml

This example would finally have env variables added to env from file in import-env and steps would contain all steps from file in import.

@Vadorequest
Copy link
Member Author

I'm not sure those options are actually being supported, we don't intend to change how YAML works.

@dxs0323
Copy link

dxs0323 commented Feb 14, 2024

I think, the idea of reusability is probably impossible to implement without actually altering either yaml file or how yaml file is being processed. Maybe we do not need to copy/paste snippets and create another final yaml... maybe the only thing is to add some extra logic behind importing/including the other files. I am interested in this feature so I will be watching this feature regardless of the outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants