Skip to content

Commit d144220

Browse files
authored
ci: path-based skip and gate job in pr_checks (#3615)
`pr_checks` runs the full matrix on every PR. #3609 touched only `apps/webapp/app/routes/admin.tsx` and still ran the 4-job CLI e2e matrix and 5-job sdk-compat suite. Adds a `changes` job using `dorny/paths-filter` and gates each tier: - webapp + e2e-webapp: `apps/webapp/**`, `packages/**`, `internal-packages/**` - packages: `packages/**` - internal: `internal-packages/**` + `packages/**` (cross-deps) - e2e (cli-v3): `packages/{cli-v3,build,core,schema-to-json}/**` - sdk-compat: `packages/{trigger-sdk,core}/**` `.configs/**`, `package.json`, `pnpm-lock.yaml`, `pnpm-workspace.yaml`, `turbo.json` are also included in every filter since they affect the whole workspace. Inlines the `units` reusable-workflow children so each can be gated independently (status check names also flatten from `units / webapp / ...` to `webapp / ...`). `unit-tests.yml` is unaffected - still used by `publish.yml`. Adds an `all-checks` gate that always runs and short-circuits to success when every dependent is success-or-skipped. With this in place a single required status check (`All PR Checks`) is enough; before this, `paths-ignore` would have left required checks Pending on docs/changeset PRs ([gh docs](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs)).
1 parent b23740b commit d144220

1 file changed

Lines changed: 136 additions & 7 deletions

File tree

.github/workflows/pr_checks.yml

Lines changed: 136 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,162 @@ name: 🤖 PR Checks
33
on:
44
pull_request:
55
types: [opened, synchronize, reopened]
6-
paths-ignore:
7-
- "docs/**"
8-
- ".changeset/**"
9-
- "hosting/**"
10-
- ".github/workflows/helm-prerelease.yml"
116

127
concurrency:
138
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
149
cancel-in-progress: true
1510

1611
permissions:
1712
contents: read
13+
pull-requests: read
1814

1915
jobs:
16+
changes:
17+
name: Detect changes
18+
runs-on: ubuntu-latest
19+
outputs:
20+
code: ${{ steps.filter.outputs.code }}
21+
webapp: ${{ steps.filter.outputs.webapp }}
22+
packages: ${{ steps.filter.outputs.packages }}
23+
internal: ${{ steps.filter.outputs.internal }}
24+
cli: ${{ steps.filter.outputs.cli }}
25+
sdk: ${{ steps.filter.outputs.sdk }}
26+
steps:
27+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
28+
id: filter
29+
with:
30+
filters: |
31+
code:
32+
- '**'
33+
- '!docs/**'
34+
- '!.changeset/**'
35+
- '!hosting/**'
36+
- '!.github/workflows/helm-prerelease.yml'
37+
webapp:
38+
- 'apps/webapp/**'
39+
- 'packages/**'
40+
- 'internal-packages/**'
41+
- '.github/workflows/pr_checks.yml'
42+
- '.github/workflows/unit-tests-webapp.yml'
43+
- '.github/workflows/e2e-webapp.yml'
44+
- '.configs/**'
45+
- 'package.json'
46+
- 'pnpm-lock.yaml'
47+
- 'pnpm-workspace.yaml'
48+
- 'turbo.json'
49+
packages:
50+
- 'packages/**'
51+
- '.github/workflows/pr_checks.yml'
52+
- '.github/workflows/unit-tests-packages.yml'
53+
- '.configs/**'
54+
- 'package.json'
55+
- 'pnpm-lock.yaml'
56+
- 'pnpm-workspace.yaml'
57+
- 'turbo.json'
58+
internal:
59+
- 'internal-packages/**'
60+
- 'packages/**'
61+
- '.github/workflows/pr_checks.yml'
62+
- '.github/workflows/unit-tests-internal.yml'
63+
- '.configs/**'
64+
- 'package.json'
65+
- 'pnpm-lock.yaml'
66+
- 'pnpm-workspace.yaml'
67+
- 'turbo.json'
68+
cli:
69+
- 'packages/cli-v3/**'
70+
- 'packages/build/**'
71+
- 'packages/core/**'
72+
- 'packages/schema-to-json/**'
73+
- '.github/workflows/pr_checks.yml'
74+
- '.github/workflows/e2e.yml'
75+
- '.configs/**'
76+
- 'package.json'
77+
- 'pnpm-lock.yaml'
78+
- 'pnpm-workspace.yaml'
79+
- 'turbo.json'
80+
sdk:
81+
- 'packages/trigger-sdk/**'
82+
- 'packages/core/**'
83+
- '.github/workflows/pr_checks.yml'
84+
- '.github/workflows/sdk-compat.yml'
85+
- '.configs/**'
86+
- 'package.json'
87+
- 'pnpm-lock.yaml'
88+
- 'pnpm-workspace.yaml'
89+
- 'turbo.json'
90+
2091
typecheck:
92+
needs: changes
93+
if: needs.changes.outputs.code == 'true'
2194
uses: ./.github/workflows/typecheck.yml
2295

23-
units:
24-
uses: ./.github/workflows/unit-tests.yml
96+
webapp:
97+
needs: changes
98+
if: needs.changes.outputs.webapp == 'true'
99+
uses: ./.github/workflows/unit-tests-webapp.yml
100+
secrets:
101+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
102+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
103+
104+
e2e-webapp:
105+
needs: changes
106+
if: needs.changes.outputs.webapp == 'true'
107+
uses: ./.github/workflows/e2e-webapp.yml
108+
secrets:
109+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
110+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
111+
112+
packages:
113+
needs: changes
114+
if: needs.changes.outputs.packages == 'true'
115+
uses: ./.github/workflows/unit-tests-packages.yml
116+
secrets:
117+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
118+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
119+
120+
internal:
121+
needs: changes
122+
if: needs.changes.outputs.internal == 'true'
123+
uses: ./.github/workflows/unit-tests-internal.yml
25124
secrets:
26125
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
27126
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
28127

29128
e2e:
129+
needs: changes
130+
if: needs.changes.outputs.cli == 'true'
30131
uses: ./.github/workflows/e2e.yml
31132
with:
32133
package: cli-v3
33134

34135
sdk-compat:
136+
needs: changes
137+
if: needs.changes.outputs.sdk == 'true'
35138
uses: ./.github/workflows/sdk-compat.yml
139+
140+
all-checks:
141+
name: All PR Checks
142+
needs:
143+
- changes
144+
- typecheck
145+
- webapp
146+
- e2e-webapp
147+
- packages
148+
- internal
149+
- e2e
150+
- sdk-compat
151+
if: always()
152+
runs-on: ubuntu-latest
153+
steps:
154+
- name: Verify all checks
155+
run: |
156+
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
157+
echo "One or more checks failed"
158+
exit 1
159+
fi
160+
if [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
161+
echo "One or more checks were cancelled"
162+
exit 1
163+
fi
164+
echo "All checks passed or were skipped due to path filters"

0 commit comments

Comments
 (0)