Does the last commit message contain a skip request?
An example workflow showing how the following commit can be used to skip the test
job.
chore: update documentation [skip test-job]
name: Example workflow
on: pull_request
jobs:
skip-commit:
runs-on: ubuntu-20.04
outputs:
should-skip: ${{ steps.skip-commit.outputs.should-skip == 'true' }}
steps:
# Checkout codebase triggered by commit
- name: Checkout Codebase
uses: actions/[email protected]
with:
# Fetch depth is 2 so that the last pull
# request commit can be read.
fetch-depth: 2
# Does the last commit message contain a skip request?
- id: skip-commit
name: Skip Commit
uses: domjtalbot/[email protected]
with:
# The string filter to find in the
# last commit.
filter: '"\[skip test-job\]"'
# A test job that only runs when the last commit
# message doesn't contain '[skip example-job]'.
test:
if: ${{ needs.skip-commit.outputs.should-skip != 'true' }}
needs: [skip-commit]
runs-on: ubuntu-20.04
steps:
- name: Tests
runs: echo Running tests...