Check triggers against a diff of changed files. For Actions with trigger parameters, like builders and deployers.
- uses: bcgov-nr/[email protected]
with:
### Required
# Paths used to check against file change (diff)
triggers: ('./backend/' './frontend/)
### Usually a bad idea / not recommended
# Branch to diff against, defaults to the default branch
diff_branch: main
The build will true if triggers fire, false otherwise.
Check if files have changed, then do something else. This is useful for cases like builds, where a job is usually only needed conditionally.
Please replace @vX.Y.Z
with the latest version number.
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Check Triggers Against Diff
outputs:
triggered: ${{ steps.test.outputs.triggered }}
runs-on: ubuntu-22.04
steps:
- uses: bcgov-nr/[email protected]
id: test
with:
triggers: ('backend/' 'frontend')
results:
name: Results of Trigger Action
needs: [check]
runs-on: ubuntu-22.04
steps:
- name: If True
if: needs.check.outputs.triggered == 'true'
uses: bcgov-nr/[email protected]
run: |
echo "Yes, there are triggered changes!"
- name: If True
if: needs.check.outputs.triggered == 'false'
uses: bcgov-nr/[email protected]
run: |
echo "No, there are not triggered changes!"