Creating a composite action
The third type of actions, besides Docker container actions and JavaScript/TypeScript actions, are composite actions. Composite actions are a wrapper for other actions. In this recipe, you will create a simple composite action and use it in a workflow – once with a bash script and once with a GitHub script.
Getting ready…
Create a new repository called CompositeActionRecipe
. Make it public so that you don’t consume any action minutes and initialize it with a README file. Clone the repository locally and open it in VS Code or open it in GitHub Codespaces.
How to do it…
- Add a new file called
action.yml
to the root of the repository. Add a name and description:name: 'Composite Action Recipe' description: 'Greets the user and returns 42.'
- Add an input called
who-to-greet
and an output calledanswer
. Note that you need the step ID to access the output. We’ll add that in the next step:inputs...