Skip to content

Commit 30bd18e

Browse files
committed
ci: path-based skip and gate job in pr_checks
1 parent 759214e commit 30bd18e

1 file changed

Lines changed: 125 additions & 7 deletions

File tree

.github/workflows/pr_checks.yml

Lines changed: 125 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,151 @@ 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+
- '.configs/**'
42+
- 'package.json'
43+
- 'pnpm-lock.yaml'
44+
- 'pnpm-workspace.yaml'
45+
- 'turbo.json'
46+
packages:
47+
- 'packages/**'
48+
- '.configs/**'
49+
- 'package.json'
50+
- 'pnpm-lock.yaml'
51+
- 'pnpm-workspace.yaml'
52+
- 'turbo.json'
53+
internal:
54+
- 'internal-packages/**'
55+
- 'packages/**'
56+
- '.configs/**'
57+
- 'package.json'
58+
- 'pnpm-lock.yaml'
59+
- 'pnpm-workspace.yaml'
60+
- 'turbo.json'
61+
cli:
62+
- 'packages/cli-v3/**'
63+
- 'packages/build/**'
64+
- 'packages/core/**'
65+
- 'packages/schema-to-json/**'
66+
- '.configs/**'
67+
- 'package.json'
68+
- 'pnpm-lock.yaml'
69+
- 'pnpm-workspace.yaml'
70+
- 'turbo.json'
71+
sdk:
72+
- 'packages/trigger-sdk/**'
73+
- 'packages/core/**'
74+
- '.configs/**'
75+
- 'package.json'
76+
- 'pnpm-lock.yaml'
77+
- 'pnpm-workspace.yaml'
78+
- 'turbo.json'
79+
2080
typecheck:
81+
needs: changes
82+
if: needs.changes.outputs.code == 'true'
2183
uses: ./.github/workflows/typecheck.yml
2284

23-
units:
24-
uses: ./.github/workflows/unit-tests.yml
85+
webapp:
86+
needs: changes
87+
if: needs.changes.outputs.webapp == 'true'
88+
uses: ./.github/workflows/unit-tests-webapp.yml
89+
secrets:
90+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
91+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
92+
93+
e2e-webapp:
94+
needs: changes
95+
if: needs.changes.outputs.webapp == 'true'
96+
uses: ./.github/workflows/e2e-webapp.yml
97+
secrets:
98+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
99+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
100+
101+
packages:
102+
needs: changes
103+
if: needs.changes.outputs.packages == 'true'
104+
uses: ./.github/workflows/unit-tests-packages.yml
105+
secrets:
106+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
107+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
108+
109+
internal:
110+
needs: changes
111+
if: needs.changes.outputs.internal == 'true'
112+
uses: ./.github/workflows/unit-tests-internal.yml
25113
secrets:
26114
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
27115
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
28116

29117
e2e:
118+
needs: changes
119+
if: needs.changes.outputs.cli == 'true'
30120
uses: ./.github/workflows/e2e.yml
31121
with:
32122
package: cli-v3
33123

34124
sdk-compat:
125+
needs: changes
126+
if: needs.changes.outputs.sdk == 'true'
35127
uses: ./.github/workflows/sdk-compat.yml
128+
129+
all-checks:
130+
name: All PR Checks
131+
needs:
132+
- changes
133+
- typecheck
134+
- webapp
135+
- e2e-webapp
136+
- packages
137+
- internal
138+
- e2e
139+
- sdk-compat
140+
if: always()
141+
runs-on: ubuntu-latest
142+
steps:
143+
- name: Verify all checks
144+
run: |
145+
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
146+
echo "One or more checks failed"
147+
exit 1
148+
fi
149+
if [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
150+
echo "One or more checks were cancelled"
151+
exit 1
152+
fi
153+
echo "All checks passed or were skipped due to path filters"

0 commit comments

Comments
 (0)