Skip to content

Commit 1d6c45c

Browse files
mishushakovclaude
andauthored
ci: skip CI jobs when unaffected by changed paths (#1380)
Adds a `dorny/paths-filter` change-detection job to the PR-triggered workflows so jobs only run when relevant paths change: Lint/Typecheck run only when package code, spec, or lint configs change; Generated files runs only when codegen inputs/outputs change; and the JS/Python/CLI SDK tests run only when the respective SDK changes (CLI also runs on JS SDK changes since it builds against it). The SDK test jobs are gated *inside* the reusable workflows via a new `run` input rather than by skipping the caller, so the required matrix status checks still report (skipped jobs report success) and branch protection stays satisfied. Shared paths (spec, lockfiles, `package.json`, `.tool-versions`) and `workflow_dispatch` runs still trigger everything. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b52eb3c commit 1d6c45c

7 files changed

Lines changed: 156 additions & 0 deletions

File tree

.github/workflows/cli_tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
required: false
88
type: string
99
default: ''
10+
run:
11+
description: 'Whether to actually run the build and tests. When false the matrix jobs are skipped (reported as success to required checks).'
12+
required: false
13+
type: boolean
14+
default: true
1015
secrets:
1116
E2B_API_KEY:
1217
required: true
@@ -16,6 +21,7 @@ permissions:
1621

1722
jobs:
1823
test:
24+
if: ${{ inputs.run }}
1925
defaults:
2026
run:
2127
working-directory: ./packages/cli

.github/workflows/generated_files.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,35 @@ permissions:
77
contents: read
88

99
jobs:
10+
changes:
11+
name: Detect changes
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
outputs:
17+
generated: ${{ steps.filter.outputs.generated }}
18+
steps:
19+
- name: Filter changed paths
20+
uses: dorny/paths-filter@v3
21+
id: filter
22+
with:
23+
filters: |
24+
generated:
25+
- 'spec/**'
26+
- 'codegen.Dockerfile'
27+
- 'Makefile'
28+
- 'packages/**'
29+
- 'pnpm-lock.yaml'
30+
- 'pnpm-workspace.yaml'
31+
- 'package.json'
32+
- '.tool-versions'
33+
- '.github/workflows/generated_files.yml'
34+
1035
check-generated:
1136
name: Generated files
37+
needs: changes
38+
if: ${{ needs.changes.outputs.generated == 'true' }}
1239
runs-on: ubuntu-latest
1340

1441
steps:

.github/workflows/js_sdk_tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
required: false
88
type: string
99
default: ''
10+
run:
11+
description: 'Whether to actually run the build and tests. When false the matrix jobs are skipped (reported as success to required checks).'
12+
required: false
13+
type: boolean
14+
default: true
1015
secrets:
1116
E2B_API_KEY:
1217
required: true
@@ -16,6 +21,7 @@ permissions:
1621

1722
jobs:
1823
test:
24+
if: ${{ inputs.run }}
1925
defaults:
2026
run:
2127
working-directory: ./packages/js-sdk

.github/workflows/lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,37 @@ on:
66
pull_request:
77

88
jobs:
9+
changes:
10+
name: Detect changes
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: read
15+
outputs:
16+
code: ${{ steps.filter.outputs.code }}
17+
steps:
18+
- name: Filter changed paths
19+
uses: dorny/paths-filter@v3
20+
id: filter
21+
with:
22+
filters: |
23+
code:
24+
- 'packages/**'
25+
- 'spec/**'
26+
- '.eslintrc.cjs'
27+
- '.prettierrc'
28+
- '.prettierignore'
29+
- '.editorconfig'
30+
- 'pnpm-lock.yaml'
31+
- 'pnpm-workspace.yaml'
32+
- 'package.json'
33+
- '.tool-versions'
34+
- '.github/workflows/lint.yml'
35+
936
lint:
1037
name: Lint
38+
needs: changes
39+
if: ${{ needs.changes.outputs.code == 'true' }}
1140
runs-on: ubuntu-latest
1241

1342
steps:

.github/workflows/python_sdk_tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
required: false
88
type: string
99
default: ''
10+
run:
11+
description: 'Whether to actually run the build and tests. When false the matrix jobs are skipped (reported as success to required checks).'
12+
required: false
13+
type: boolean
14+
default: true
1015
secrets:
1116
E2B_API_KEY:
1217
required: true
@@ -16,6 +21,7 @@ permissions:
1621

1722
jobs:
1823
test:
24+
if: ${{ inputs.run }}
1925
defaults:
2026
run:
2127
working-directory: ./packages/python-sdk

.github/workflows/sdk_tests.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,101 @@ permissions:
1010
contents: read
1111

1212
jobs:
13+
changes:
14+
name: Detect changes
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
pull-requests: read
19+
outputs:
20+
js: ${{ steps.filter.outputs.js }}
21+
python: ${{ steps.filter.outputs.python }}
22+
cli: ${{ steps.filter.outputs.cli }}
23+
steps:
24+
- name: Filter changed paths
25+
# On workflow_dispatch there is no PR diff and paths-filter would fall
26+
# back to git (failing without a checkout); the run inputs below force a
27+
# full run for that event instead, so we only filter on pull_request.
28+
if: github.event_name == 'pull_request'
29+
uses: dorny/paths-filter@v3
30+
id: filter
31+
with:
32+
filters: |
33+
shared: &shared
34+
- '.github/workflows/sdk_tests.yml'
35+
- 'spec/**'
36+
- 'pnpm-lock.yaml'
37+
- 'pnpm-workspace.yaml'
38+
- 'package.json'
39+
- '.tool-versions'
40+
js:
41+
- *shared
42+
- '.github/workflows/js_sdk_tests.yml'
43+
- 'packages/js-sdk/**'
44+
python:
45+
- *shared
46+
- '.github/workflows/python_sdk_tests.yml'
47+
- 'packages/python-sdk/**'
48+
- 'packages/connect-python/**'
49+
cli:
50+
- *shared
51+
- '.github/workflows/cli_tests.yml'
52+
- 'packages/cli/**'
53+
- 'packages/js-sdk/**'
54+
1355
js-tests:
1456
name: Production / JS SDK Tests
57+
needs: changes
1558
uses: ./.github/workflows/js_sdk_tests.yml
59+
with:
60+
run: ${{ needs.changes.outputs.js == 'true' || github.event_name == 'workflow_dispatch' }}
1661
secrets:
1762
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
1863

1964
python-tests:
2065
name: Production / Python SDK Tests
66+
needs: changes
2167
uses: ./.github/workflows/python_sdk_tests.yml
68+
with:
69+
run: ${{ needs.changes.outputs.python == 'true' || github.event_name == 'workflow_dispatch' }}
2270
secrets:
2371
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
2472

2573
cli-tests:
2674
name: Production / CLI Tests
75+
needs: changes
2776
uses: ./.github/workflows/cli_tests.yml
77+
with:
78+
run: ${{ needs.changes.outputs.cli == 'true' || github.event_name == 'workflow_dispatch' }}
2879
secrets:
2980
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
3081

3182
js-tests-staging:
3283
name: Staging / JS SDK Tests
84+
needs: changes
3385
uses: ./.github/workflows/js_sdk_tests.yml
3486
with:
3587
E2B_DOMAIN: ${{ vars.E2B_DOMAIN_STAGING }}
88+
run: ${{ needs.changes.outputs.js == 'true' || github.event_name == 'workflow_dispatch' }}
3689
secrets:
3790
E2B_API_KEY: ${{ secrets.E2B_API_KEY_STAGING }}
3891

3992
python-tests-staging:
4093
name: Staging / Python SDK Tests
94+
needs: changes
4195
uses: ./.github/workflows/python_sdk_tests.yml
4296
with:
4397
E2B_DOMAIN: ${{ vars.E2B_DOMAIN_STAGING }}
98+
run: ${{ needs.changes.outputs.python == 'true' || github.event_name == 'workflow_dispatch' }}
4499
secrets:
45100
E2B_API_KEY: ${{ secrets.E2B_API_KEY_STAGING }}
46101

47102
cli-tests-staging:
48103
name: Staging / CLI Tests
104+
needs: changes
49105
uses: ./.github/workflows/cli_tests.yml
50106
with:
51107
E2B_DOMAIN: ${{ vars.E2B_DOMAIN_STAGING }}
108+
run: ${{ needs.changes.outputs.cli == 'true' || github.event_name == 'workflow_dispatch' }}
52109
secrets:
53110
E2B_API_KEY: ${{ secrets.E2B_API_KEY_STAGING }}

.github/workflows/typecheck.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,33 @@ on:
44
pull_request:
55

66
jobs:
7+
changes:
8+
name: Detect changes
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
outputs:
14+
code: ${{ steps.filter.outputs.code }}
15+
steps:
16+
- name: Filter changed paths
17+
uses: dorny/paths-filter@v3
18+
id: filter
19+
with:
20+
filters: |
21+
code:
22+
- 'packages/**'
23+
- 'spec/**'
24+
- 'pnpm-lock.yaml'
25+
- 'pnpm-workspace.yaml'
26+
- 'package.json'
27+
- '.tool-versions'
28+
- '.github/workflows/typecheck.yml'
29+
730
typecheck:
831
name: Typecheck
32+
needs: changes
33+
if: ${{ needs.changes.outputs.code == 'true' }}
934
runs-on: ubuntu-latest
1035
permissions:
1136
contents: read

0 commit comments

Comments
 (0)