Github Actions have native support to skip an entire workflow depending on commit message. But since we rely on status checks for our Pull Requests to be green, we need another option.
This action accepts an input string skipOnCommitMsg which will be used to check if the commit message contains the given string.
If yes the output shouldExecute will be set to false. true otherwise. For full input / output list and other configurations check action.yml.
This example shows how to set up two dependant jobs, the second will only be executed if the output from checkExecution job is true.
# jobscheckExecution:
runs-on: ubuntu-latestoutputs:
shouldExecute: ${{ steps.stepCheckExecution.outputs.shouldExecute }}steps:
- id: stepCheckExecutionname: Check for executionuses: shiftcode/github-action-skip@releases/v2-alpha.0with:
skipOnCommitMsg: '[skip_build]'githubToken: ${{secrets.GH_TOKEN_3}}build:
runs-on: ubuntu-latestneeds: checkExecution# only execute if not skipped by commit messageif: needs.checkExecution.outputs.shouldExecute == 'true'steps: ...- implement your changes
- commit changes (pre-commit hook will do some code checks / changes and build the artifacts)
- set tag
git tag -a -m "my fancy release" v0.0.X - push with tags
git push --follow-tags