File tree Expand file tree Collapse file tree 1 file changed +41
-1
lines changed
Expand file tree Collapse file tree 1 file changed +41
-1
lines changed Original file line number Diff line number Diff line change 3232 CARGO_TERM_COLOR : always
3333
3434jobs :
35+ determine_changes :
36+ name : Determine changes
37+ runs-on : ubuntu-latest
38+ outputs :
39+ # Flag that is raised when any rust code is changed.
40+ rust_code : ${{ steps.check_rust_code.outputs.changed }}
41+ steps :
42+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
43+ with :
44+ fetch-depth : 0
45+ persist-credentials : false
46+
47+ - name : Determine merge base
48+ id : merge_base
49+ run : |
50+ sha=$(git merge-base HEAD "origin/${BASE_REF}")
51+ echo "sha=${sha}" >> "$GITHUB_OUTPUT"
52+ env :
53+ BASE_REF : ${{ github.event.pull_request.base.ref || 'main' }}
54+
55+ - name : Check if there was any code related change
56+ id : check_rust_code
57+ run : |
58+ if git diff --quiet "${MERGE_BASE}...HEAD" -- \
59+ ':!Lib/**' \
60+ ':!scripts/**' \
61+ ':!extra_tests/**' \
62+ ':.github/workflows/ci.yaml' \
63+ ; then
64+ echo "changed=false" >> "$GITHUB_OUTPUT"
65+ else
66+ echo "changed=true" >> "$GITHUB_OUTPUT"
67+ fi
68+ env :
69+ MERGE_BASE : ${{ steps.merge_base.outputs.sha }}
70+
3571 rust_tests :
3672 if : ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
3773 env :
@@ -109,9 +145,13 @@ jobs:
109145 if : runner.os == 'Linux'
110146
111147 cargo_check :
112- if : ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
113148 name : cargo check
114149 runs-on : ${{ matrix.os }}
150+ needs :
151+ - determine_changes
152+ if : |
153+ !contains(github.event.pull_request.labels.*.name, 'skip:ci') &&
154+ needs.determine_changes.outputs.rust_code == 'true'
115155 strategy :
116156 matrix :
117157 include :
You can’t perform that action at this time.
0 commit comments