github - creating a basic composite action
What is github composite action allow you to host multiple commonly used task/steps/actions into a single actions. This prevents repetition of commonly used task.
To get started, you create a repository that will host your actions/template. Create a file called action.yml
For example, this can be your template
https://github.com/mitzenjeremywoo/hello-world-composite-action
Next, to test out your composite repository, create another repository and create your workflow.
It should look like this. Notice how it refers to hello-world-composite-action@v1
on: [push]
jobs:
hello_world_job:
runs-on: ubuntu-latest
name: A job to say hello
steps:
- uses: actions/checkout@v4
- id: foo
uses: mitzenjeremywoo/hello-world-composite-action@v1
with:
who-to-greet: 'Mona the Octocat'
- run: echo random-number "$RANDOM_NUMBER"
shell: bash
env:
RANDOM_NUMBER: ${{ steps.foo.outputs.random-number }}
Comments