Skip to content

Commit dc28e38

Browse files
ci: scope generation validation to generation-affecting files only (#173)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 5d1136d commit dc28e38

2 files changed

Lines changed: 33 additions & 28 deletions

File tree

.github/workflows/generate-command.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,36 @@ concurrency:
6767
cancel-in-progress: true
6868

6969
jobs:
70+
check-paths:
71+
name: Check Generation Paths
72+
if: ${{ inputs.dry_run }}
73+
runs-on: ubuntu-latest
74+
outputs:
75+
should_run: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.generation == 'true' }}
76+
steps:
77+
- name: Checkout repository
78+
uses: actions/checkout@v4
79+
- name: Filter changed paths
80+
uses: dorny/paths-filter@v4
81+
id: filter
82+
with:
83+
filters: |
84+
generation:
85+
- '.speakeasy/**'
86+
- '.genignore'
87+
- '.github/speakeasy/**'
88+
- '.github/workflows/generate-command.yml'
89+
- 'gen.yaml'
90+
- 'overlays/**'
91+
- 'README.md'
92+
- 'scripts/**'
93+
- 'poe_tasks.toml'
94+
- 'src/**'
95+
7096
generate:
7197
name: Generate SDK
98+
needs: [check-paths]
99+
if: ${{ always() && (!inputs.dry_run || needs.check-paths.outputs.should_run == 'true') }}
72100
runs-on: ubuntu-latest
73101
timeout-minutes: 30
74102
outputs:

.github/workflows/test-full.yml

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
# and that the committed generated code matches what the generation pipeline produces.
55
#
66
# Jobs:
7-
# 1. validate: Runs the full generation pipeline in dry-run mode
7+
# 1. validate: Calls generate-command.yml with dry_run=true. The generation
8+
# workflow handles its own path filtering — it skips the Generate SDK job
9+
# when only non-generation files changed (e.g., dev dependency bumps).
810
# 2. zero-diff: Checks for drift using the validate job's outputs (in-place git status).
911
# If drift is detected, the check fails and posts a comment telling the author to run /generate.
1012
#
1113
# This workflow calls the main generation workflow with dry_run=true to ensure
1214
# both workflows use the same generation logic.
13-
#
14-
# Note: paths-ignore is NOT used at the workflow level because GitHub treats a
15-
# workflow that never runs as "expected" (pending), which blocks required checks.
16-
# Instead, we filter paths at the job level so skipped jobs report as "skipped"
17-
# (equivalent to "passed" for required checks).
1815

1916
name: Test (Full)
2017

@@ -27,37 +24,17 @@ permissions:
2724
pull-requests: write
2825

2926
jobs:
30-
check-paths:
31-
name: Check Changed Paths
32-
runs-on: ubuntu-latest
33-
steps:
34-
- name: Checkout repository
35-
uses: actions/checkout@v4
36-
- name: Filter changed paths
37-
uses: dorny/paths-filter@v4
38-
id: filter
39-
with:
40-
filters: |
41-
generation:
42-
- '**'
43-
- '!README.md'
44-
- '!docs/**'
45-
outputs:
46-
should_run: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.generation == 'true' }}
47-
4827
validate:
4928
name: Validate Generation (Dry Run)
50-
needs: check-paths
51-
if: needs.check-paths.outputs.should_run == 'true'
5229
uses: ./.github/workflows/generate-command.yml
5330
with:
5431
dry_run: true
5532
secrets: inherit
5633

5734
zero-diff:
5835
name: Zero-Diff Check (Generated Code)
59-
needs: [check-paths, validate]
60-
if: needs.check-paths.outputs.should_run == 'true' && github.event_name == 'pull_request'
36+
needs: [validate]
37+
if: github.event_name == 'pull_request'
6138
runs-on: ubuntu-latest
6239
permissions:
6340
contents: read

0 commit comments

Comments
 (0)