Run common task in github action or alternative of before_script in github workflow ci #27136
-
Hello all, I’m trying to shift my CI workflow from GitLab to Github So just having some queries:
Example:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Can we place all common commands in a job that is like |
Beta Was this translation helpful? Give feedback.
-
@uditgaurav,
I think this is not work. if you are using GitHub-hosted runners in to run the job in your workflow, each job in the workflow executes in a fresh instance of the virtual machine. So, the system configurations (such as environment variables) you set in a job generally are not applicable to other jobs. If your projects really need the similar features, I recommend you directly report a feature request here. That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions. |
Beta Was this translation helpful? Give feedback.
-
You can use composite run steps actions . These are actions that are solely defined in YAML (documentation). Workflow
Composite run steps action
|
Beta Was this translation helpful? Give feedback.
@uditgaurav,
Currently, GitHub Actions does not support the feature likes before_script in Gitlab CI.
I think this is not work. if you are using GitHub-hosted runners in to run the job in your workflow, each job in the workflow executes in a fresh instance of the virtual machine. So, the system configurations (such as environment variables) you set in a job generally are not applicable to other jobs.
And GitHub Actions also does not support the feature likes Template (such as job templates and step templates) for YAML Pipelines on Azure Pipelines .
If your projects really need the similar feat…