1- name: "Codegen Check"on: push: branches: - main pull_request: types: [opened, synchronize, reopened, ready_for_review] paths: - 'scripts/codegen/**' - 'nodejs/src/generated/**' - 'dotnet/src/Generated/**' - 'python/copilot/generated/**' - 'go/generated_*.go' - 'go/rpc/**' - 'rust/src/generated/**' - '.github/workflows/codegen-check.yml' workflow_dispatch:permissions: contents: readjobs: check: name: "Verify generated files are up-to-date" if: github.event.repository.fork == false runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - uses: actions/setup-go@v5 with: go-version: '1.22' # Rust generator runs `cargo fmt` on the output, so we need a toolchain with rustfmt. - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: toolchain: "1.94.0" components: rustfmt # Nightly rustfmt for unstable format options (group_imports, # imports_granularity, reorder_impl_items) — pinned in # `rust/.rustfmt.nightly.toml`. The Rust generator emits unconsolidated # imports under stable rustfmt; nightly fmt consolidates them to match # the canonical committed form. - name: Install nightly rustfmt uses: dtolnay/rust-toolchain@master with: toolchain: nightly-2026-04-14 components: rustfmt - name: Install nodejs SDK dependencies working-directory: ./nodejs run: npm ci - name: Install codegen dependencies working-directory: ./scripts/codegen run: npm ci - name: Run codegen working-directory: ./scripts/codegen run: npm run generate - name: Apply nightly rustfmt to generated Rust output working-directory: ./rust run: cargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml - name: Check for uncommitted changes run: | if [ -n "$(git status --porcelain)" ]; then echo "::error::Generated files are out of date. Run 'cd scripts/codegen && npm run generate' and commit the changes." git diff --stat git diff exit 1 fi echo "✅ Generated files are up-to-date"
1+ name : " Codegen Check"
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ types : [opened, synchronize, reopened, ready_for_review]
9+ paths :
10+ - ' scripts/codegen/**'
11+ - ' nodejs/src/generated/**'
12+ - ' dotnet/src/Generated/**'
13+ - ' python/copilot/generated/**'
14+ - ' go/generated_*.go'
15+ - ' go/rpc/**'
16+ - ' rust/src/generated/**'
17+ - ' .github/workflows/codegen-check.yml'
18+ workflow_dispatch :
19+
20+ permissions :
21+ contents : read
22+
23+ jobs :
24+ check :
25+ name : " Verify generated files are up-to-date"
26+ if : github.event.repository.fork == false
27+ runs-on : ubuntu-latest
28+ steps :
29+ - uses : actions/checkout@v4
30+
31+ - uses : actions/setup-node@v4
32+ with :
33+ node-version : 22
34+
35+ - uses : actions/setup-go@v5
36+ with :
37+ go-version : ' 1.22'
38+
39+ # Rust generator runs `cargo fmt` on the output, so we need a toolchain with rustfmt.
40+ - name : Install Rust toolchain
41+ uses : dtolnay/rust-toolchain@stable
42+ with :
43+ toolchain : " 1.94.0"
44+ components : rustfmt
45+
46+ # Nightly rustfmt for unstable format options (group_imports,
47+ # imports_granularity, reorder_impl_items) — pinned in
48+ # `rust/.rustfmt.nightly.toml`. The Rust generator emits unconsolidated
49+ # imports under stable rustfmt; nightly fmt consolidates them to match
50+ # the canonical committed form.
51+ - name : Install nightly rustfmt
52+ uses : dtolnay/rust-toolchain@master
53+ with :
54+ toolchain : nightly-2026-04-14
55+ components : rustfmt
56+
57+ - name : Install nodejs SDK dependencies
58+ working-directory : ./nodejs
59+ run : npm ci
60+
61+ - name : Install codegen dependencies
62+ working-directory : ./scripts/codegen
63+ run : npm ci
64+
65+ - name : Run codegen
66+ working-directory : ./scripts/codegen
67+ run : npm run generate
68+
69+ - name : Apply nightly rustfmt to generated Rust output
70+ working-directory : ./rust
71+ run : cargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml
72+
73+ - name : Check for uncommitted changes
74+ run : |
75+ if [ -n "$(git status --porcelain)" ]; then
76+ echo "::error::Generated files are out of date. Run 'cd scripts/codegen && npm run generate' and commit the changes."
77+ git diff --stat
78+ git diff
79+ exit 1
80+ fi
81+ echo "✅ Generated files are up-to-date"
0 commit comments