File tree Expand file tree Collapse file tree 2 files changed +51
-31
lines changed
Expand file tree Collapse file tree 2 files changed +51
-31
lines changed Original file line number Diff line number Diff line change 1+ name : path-filter
2+ description : Detect changed files by provideding a list of glob patterns
3+ inputs :
4+ patterns :
5+ description : A list of glob patterns to check for changes. Defaults to '*'.
6+ default : " *"
7+ outputs :
8+ matched :
9+ description : Returns if any changed files were matched by the provided glob patterns.
10+ value : ${{ steps.check.outputs.MATCHED }}
11+ runs :
12+ using : composite
13+ steps :
14+ - name : Check for changed files
15+ id : check
16+ shell : bash
17+ env :
18+ PATTERNS : ${{ inputs.patterns }}
19+ run : |
20+ set -euo pipefail
21+
22+ # This is cursed... we use `.[] | .` to remove quotes and any yaml formatting.
23+ readarray -t GLOBS < <(echo -n "$PATTERNS" | yq '.[] | .')
24+
25+ MATCHED="false"
26+ for GLOB in "${GLOBS[@]}"; do
27+ if ! git diff --exit-code --name-only "${BASE_SHA}.." -- "$GLOB"; then
28+ # When git diff exist with an error, that means there was a diff
29+ # for the glob.
30+ MATCHED="true"
31+ fi
32+ done
33+
34+ echo "MATCHED=$MATCHED" | tee -a "$GITHUB_OUTPUT"
Original file line number Diff line number Diff line change 1212 branches :
1313 - main
1414 tags :
15- - ' [0-9][0-9].[0-9]+.[0-9]+-rc[0-9]+'
16- - ' [0-9][0-9].[0-9]+.[0-9]+'
15+ - " [0-9][0-9].[0-9]+.[0-9]+-rc[0-9]+"
16+ - " [0-9][0-9].[0-9]+.[0-9]+"
1717 schedule :
1818 # Run every Saturday morning: https://crontab.guru/#15_3_*_*_6
19- - cron : ' 15 3 * * 6'
19+ - cron : " 15 3 * * 6"
2020 pull_request :
2121 # paths:
2222 # - '.github/workflows/build.yaml'
@@ -55,36 +55,22 @@ jobs:
5555 persist-credentials : false
5656 submodules : recursive
5757 fetch-depth : 0
58- - id : check
59- shell : bash
60- run : |
61- set -x
62- # - '.github/workflows/build.yaml'
63- # - 'rust-toolchain.toml'
64- # - '.dockerignore'
65- # - 'deploy/**'
66- # - '.cargo/**'
67- # - 'docker/**'
68- # - 'Cargo.*'
69- # - '*.rs'
7058
71- # Temp globs
72- # The action will need to get this from inputs somehow
73- # This is cursed... we use `.[] | .` to remove quotes and any yaml formatting.
74- readarray -t GLOBS < <(yq --null-input '["*.rs", ".cargo/**"]' | yq '.[] | .')
75-
76- MATCHED="false"
77- for GLOB in "${GLOBS[@]}"; do
78- if ! git diff --exit-code --name-only "${BASE_SHA}.." -- "$GLOB"; then
79- # When git diff exist with an error, that means there was a diff
80- # for the glob.
81- MATCHED="true"
82- fi
83- done
84-
85- echo "MATCHED=$MATCHED" | tee -a "$GITHUB_OUTPUT"
59+ - name : Check for changed files
60+ id : check
61+ uses : ./.github/actions/path-filter
62+ with :
63+ patterns : |
64+ - '.github/workflows/build.yaml'
65+ - 'rust-toolchain.toml'
66+ - '.dockerignore'
67+ - 'deploy/**'
68+ - '.cargo/**'
69+ - 'docker/**'
70+ - 'Cargo.*'
71+ - '*.rs'
8672 outputs :
87- matched : ${{ steps.check.outputs.MATCHED }}
73+ matched : ${{ steps.check.outputs.matched }}
8874
8975 cargo-udeps :
9076 name : Run cargo-udeps
You can’t perform that action at this time.
0 commit comments