Only run the full test suite if required files are touched. This prevents the whole workflow from running for meta/readme changes

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
pull/4852/head
Adam Warner 2 years ago
parent 21158cb6bc
commit 8f7f92cd23
No known key found for this signature in database
GPG Key ID: 872950F3ECF2B173

@ -8,6 +8,30 @@ permissions:
contents: read
jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
requires-distro-test: ${{ steps.filter.outputs.requires-distro-test }}
steps:
-
name: Checkout Repo
uses: actions/checkout@v3
-
name: Check which files have been touched
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
requires-distro-test:
- 'advanced/**'
- 'automated install/**'
- 'manpages/**'
- 'test/**'
- 'gravity.sh'
- 'pihole'
smoke-tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
@ -17,6 +41,7 @@ jobs:
uses: actions/checkout@v3.0.2
-
name: Check scripts in repository are executable
if: ${{ needs.changes.outputs.requires-distro-test == 'true' }}
run: |
IFS=$'\n';
for f in $(find . -name '*.sh'); do if [[ ! -x $f ]]; then echo "$f is not executable" && FAIL=1; fi ;done
@ -35,11 +60,10 @@ jobs:
name: Run editorconfig-checker
run: editorconfig-checker
distro-test:
if: github.event.pull_request.draft == false
needs: [ smoke-tests, changes ]
if: ${{ github.event.pull_request.draft == false && needs.changes.outputs.requires-distro-test == 'true' }}
runs-on: ubuntu-latest
needs: smoke-tests
strategy:
fail-fast: false
matrix:

Loading…
Cancel
Save