Skip to content
雪猫 edited this page Mar 25, 2022 · 3 revisions

Create a Composite Action

Use this template to bootstrap the creation of a composite action.:rocket:

This template includes tests, a validation workflow and versioning guidance.

Other languages

Create an action from this template

Click the Use this Template and provide the new repo details for your action.

See the documentation

Change action.yml

The action.yml defines the inputs and outputs for your action.

Update the action.yml with your name, description, inputs, outputs and branding for your action.

See the documentation.

Change the Code

The action.yml also defines the steps for your action.

Update the action.yml with your steps for your action.

Test

Test is written in test.yml.

You can use test, [, [[ and (( commands for asserting on bash.

Be aware that [ and [[ with single line need to be enclosed in '' or "" on YAML.

- run: test "${GREET}" = "Hello World"
- run: '[ "${GREET}" = "Hello World" ]'
- run: '[[ "${GREET}" == "Hello World" ]'
- run: (( ${NUMBER} == 1 ))

Validate

You can now validate the action by referencing ./ in a workflow in your repo (see test.yml)

- uses: ./
  with:
    who-to-greet: World

See the actions tab for runs of this action! 🚀

Usage

After testing you can create a v1 tag to reference the stable and latest V1 action

Other official action templates