Skip to content

docs: add named job example #260

docs: add named job example

docs: add named job example #260

Workflow file for this run

name: Example Action
on:
push:
branches: ['main']
jobs:
build:
name: build name
runs-on: ubuntu-latest
steps:
- run: env | grep GITHUB_
- uses: actions/checkout@v4
- uses: ./
with:
job-name: build name
- run: |
echo github.job: ${{ github.job }}
build-with-environment:
runs-on: ubuntu-latest
environment: test
steps:
- uses: actions/checkout@v4
- uses: ./
build-with-matrix:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x, 20.x]
steps:
- uses: actions/checkout@v4
- uses: ./
- run: |
echo github.job: ${{ github.job }}
build-with-matrix-nested-objects:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-16.04, ubuntu-latest ]
compiler: [ { cpp: g++, c: gcc }, { cpp: g++-8, c: gcc-8 } ]
steps:
- uses: actions/checkout@v4
- uses: ./
- run: |
echo github.job: ${{ github.job }}
build-with-matrix-nested-arrays:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [ [g++, gcc ], [g++-8, gcc-8 ] ]
steps:
- uses: actions/checkout@v4
- uses: ./
- run: |
echo github.job: ${{ github.job }}
build-with-reusable-workflow-with-matrix:
strategy:
matrix:
node-version: [ 22.x, 20.x ]
uses: ./.github/workflows/example-reusable.yml
with:
# IMPORTANT ensure first value match the surrounding job name
# IMPORTANT If the surrounding workflow is a reusable workflow itself, append ', ${{ inputs.workflow-context }}'
workflow-context: build-with-reusable-workflow-with-matrix, ${{ toJSON(matrix) }}
build-with-reusable-workflow-nested:
uses: ./.github/workflows/example-reusable-nested.yml
with:
# IMPORTANT ensure first value match the surrounding job name
# IMPORTANT If the surrounding workflow is a reusable workflow itself, append ', ${{ inputs.workflow-context }}'
workflow-context: build-with-reusable-workflow-nested, ${{ toJSON(matrix) }}