Combine Multiple Steps #26695
-
I have a few steps (including actions from market place). I will need to use these same steps in multiple workflows. Is it possible to combine and move them to a separate file (say, action.yml) and refer them in the workflow, so that I don’t have to duplicate the same steps in every workflow? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
If all the steps are just “run” steps, then you can create a custom composite action that uses those run steps. However, we don’t support templates right now, so you don’t have the ability to define multiple “uses” steps in a separate YML file. In that instance, you do have to duplicate the code. |
Beta Was this translation helpful? Give feedback.
-
Isn’t this the same as Uses step in Composite Action? (same author) |
Beta Was this translation helpful? Give feedback.
-
Yes @laughedelic . I posted it to ensure I am conveying the question correctly. Also, the documentation lacks. Hence there is no clarity. I don’t want to duplicate the same steps in multiple workflows. Hence I was looking for a way to make it reusable. |
Beta Was this translation helpful? Give feedback.
-
The feature you wanted may have arrived a few months after you asked about it:
GitHub Actions: Reduce duplication with action composition | GitHub ChangelogGitHub Actions: Reduce duplication with action composition Est. reading time: 1 minute |
Beta Was this translation helpful? Give feedback.
If all the steps are just “run” steps, then you can create a custom composite action that uses those run steps.
However, we don’t support templates right now, so you don’t have the ability to define multiple “uses” steps in a separate YML file. In that instance, you do have to duplicate the code.