Skip to content

Commit a8280f1

Browse files
authored
ci: fix code path filter negation (#3637)
`dorny/paths-filter` defaults to OR semantics across the pattern array, so the leading `**` matched every file and the `!...` excludes were no-ops. The `code` filter has been returning `true` for every PR since #3615. Split into two filter steps: `code` moves into its own step with `predicate-quantifier: every` so excludes actually subtract. The two re-include workflow files become a separate `typecheck_self` filter that the `typecheck` job ORs into its `if:`. Side effect: workflow-file-only PRs that don't touch `pr_checks.yml` or `typecheck.yml` no longer trigger typecheck. Previously they did because the filter was broken-true.
1 parent 05d3ab1 commit a8280f1

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/pr_checks.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@ jobs:
1717
name: Detect changes
1818
runs-on: ubuntu-latest
1919
outputs:
20-
code: ${{ steps.filter.outputs.code }}
20+
code: ${{ steps.code_filter.outputs.code }}
21+
typecheck_self: ${{ steps.filter.outputs.typecheck_self }}
2122
webapp: ${{ steps.filter.outputs.webapp }}
2223
packages: ${{ steps.filter.outputs.packages }}
2324
internal: ${{ steps.filter.outputs.internal }}
2425
cli: ${{ steps.filter.outputs.cli }}
2526
sdk: ${{ steps.filter.outputs.sdk }}
2627
steps:
28+
# `code` uses `every` semantics so the negation patterns actually subtract.
29+
# With the default `some` quantifier, `**` matches every file and the
30+
# subsequent `!...` patterns are no-ops (each pattern is OR'd, not AND'd).
2731
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
28-
id: filter
32+
id: code_filter
2933
with:
34+
predicate-quantifier: every
3035
filters: |
3136
code:
3237
- '**'
@@ -37,6 +42,11 @@ jobs:
3742
- '!references/**'
3843
- '!**/*.md'
3944
- '!**/.env.example'
45+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
46+
id: filter
47+
with:
48+
filters: |
49+
typecheck_self:
4050
- '.github/workflows/pr_checks.yml'
4151
- '.github/workflows/typecheck.yml'
4252
webapp:
@@ -95,7 +105,7 @@ jobs:
95105
96106
typecheck:
97107
needs: changes
98-
if: needs.changes.outputs.code == 'true'
108+
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.typecheck_self == 'true'
99109
uses: ./.github/workflows/typecheck.yml
100110

101111
webapp:

0 commit comments

Comments
 (0)