File tree Expand file tree Collapse file tree 2 files changed +37
-30
lines changed
Expand file tree Collapse file tree 2 files changed +37
-30
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,13 @@ jobs:
3333
3434 for f in "${CHANGED[@]}"; do
3535 [ -f "$f" ] || continue
36+ # Don't scan CI/workflow files
37+ [[ "$f" == .github/* ]] && continue
38+ [[ "$f" == AGENTS.md ]] && continue
3639 case "$f" in
3740 *.md|*.txt|*.yml|*.yaml|*.json|*.toml|*.ts|*.tsx|*.js|*.jsx|*.sh|*.py|*.rb|*.tf|*.hcl)
3841 if grep -Einq "$FORBIDDEN" "$f"; then
39- echo "::error file=$f::Potential internal-only marker detected"
42+ echo "::error file=$f::Potential internal-only marker detected in $f "
4043 grep -Ein "$FORBIDDEN" "$f" || true
4144 STATUS=1
4245 fi
Original file line number Diff line number Diff line change @@ -9,44 +9,48 @@ permissions:
99
1010jobs :
1111 changed-files :
12- if : github.event.pull_request.draft == false
1312 runs-on : ubuntu-latest
1413 outputs :
15- source_changed : ${{ steps.filter .outputs.source }}
16- tests_changed : ${{ steps.filter .outputs.tests }}
14+ source_changed : ${{ steps.source .outputs.diff != '' }}
15+ tests_changed : ${{ steps.tests .outputs.diff != '' }}
1716 steps :
1817 - uses : actions/checkout@v4
19-
20- - uses : dorny/paths-filter@v3
21- id : filter
2218 with :
23- filters : |
24- source:
25- - '**/*.ts'
26- - '**/*.tsx'
27- - '**/*.js'
28- - '**/*.jsx'
29- - '**/*.mjs'
30- - '**/*.go'
31- - '**/*.rs'
32- - '**/*.py'
33- - '**/*.sh'
34- - '!**/*.test.*'
35- - '!**/*.spec.*'
36- tests:
37- - '**/*.test.*'
38- - '**/*.spec.*'
39- - '**/test/**'
40- - '**/tests/**'
19+ fetch-depth : 0
20+ - uses : technote-space/get-diff-action@v6
21+ id : source
22+ with :
23+ PATTERNS : |
24+ **/*.ts
25+ **/*.tsx
26+ **/*.js
27+ **/*.jsx
28+ **/*.mjs
29+ **/*.go
30+ **/*.rs
31+ **/*.py
32+ **/*.sh
33+ EXCLUDE_PATTERNS : |
34+ **/*.test.*
35+ **/*.spec.*
36+ .github/**
37+ - uses : technote-space/get-diff-action@v6
38+ id : tests
39+ with :
40+ PATTERNS : |
41+ **/*.test.*
42+ **/*.spec.*
43+ **/test/**
44+ **/tests/**
45+ EXCLUDE_PATTERNS : |
46+ .github/**
4147
4248 enforce-test-delta :
4349 needs : changed-files
44- if : needs.changed-files.outputs.source_changed == 'true'
50+ if : needs.changed-files.outputs.source_changed == 'true' && needs.changed-files.outputs.tests_changed != 'true'
4551 runs-on : ubuntu-latest
4652 steps :
4753 - name : Require test updates when source changes
4854 run : |
49- if [ "${{ needs.changed-files.outputs.tests_changed }}" != "true" ]; then
50- echo "Source files changed without accompanying test changes."
51- exit 1
52- fi
55+ echo "::error::Source files changed without accompanying test changes."
56+ exit 1
You can’t perform that action at this time.
0 commit comments