Skip to content

Instantly share code, notes, and snippets.

@ali-kamalizade
Created May 18, 2022 21:51
Show Gist options
  • Save ali-kamalizade/8b7500596ebc3db59378d057e9fa2e31 to your computer and use it in GitHub Desktop.
Save ali-kamalizade/8b7500596ebc3db59378d057e9fa2e31 to your computer and use it in GitHub Desktop.
A sample GitHub workflow using paths filters that can be referenced on the step and job level (e.g. to skip a job if there were no related code changes)
jobs:
changes:
runs-on: ubuntu-latest
name: Check changes
outputs:
functions: ${{ steps.filter.outputs.functions }}
steps:
- uses: actions/checkout@v3
name: Checkout project to determine changed files
with:
fetch-depth: 50
- uses: dorny/paths-filter@v2
id: filter
with:
base: main
filters: |
functions:
- 'functions/**/*'
- 'package.json'
functions:
runs-on: ubuntu-latest
name: Functions CI
needs: [changes]
# run job if there were actual changes
if: ${{ needs.changes.outputs.functions == 'true' }}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment