Skip to content

Commit 2441b0d

Browse files
committed
Add override for breaking changes
1 parent e629f27 commit 2441b0d

2 files changed

Lines changed: 54 additions & 4 deletions

File tree

.github/workflows/breaking-changes.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,43 @@ permissions:
66
on:
77
pull_request:
88
branches: [main]
9-
types: [opened, synchronize, reopened]
9+
# Re-run when override labels are added or removed
10+
types: [opened, synchronize, reopened, labeled, unlabeled]
1011

1112
jobs:
1213
proto-breaking:
1314
runs-on: ubuntu-latest
15+
env:
16+
SKIP: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change:proto') || contains(github.event.pull_request.labels.*.name, 'breaking-change:approved') }}
1417
steps:
18+
- name: Skipped — intentional breaking change (label override)
19+
if: env.SKIP == 'true'
20+
run: |
21+
echo "::notice title=Proto breaking check skipped::This PR has label breaking-change:proto or breaking-change:approved. A maintainer acknowledged an intentional proto break. Remove the label to re-enable buf breaking."
22+
1523
- name: Checkout code
24+
if: env.SKIP != 'true'
1625
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1726
with:
1827
fetch-depth: 0
1928
submodules: recursive
2029
token: ${{ secrets.GITHUB_TOKEN }}
2130

2231
- name: Setup Bun
32+
if: env.SKIP != 'true'
2333
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
2434
with:
2535
bun-version: 1.3.12
2636

2737
- name: Install dependencies
38+
if: env.SKIP != 'true'
2839
run: bun install --frozen-lockfile
2940

3041
# cre-sdk's buf.yaml points at ../../submodules/chainlink-protos/cre, which buf rejects when
3142
# --against uses subdir=packages/cre-sdk (module path escapes the context). Run breaking on
3243
# the chainlink-protos workspace instead, comparing HEAD to the submodule commit pinned on main.
3344
- name: Buf breaking (proto)
45+
if: env.SKIP != 'true'
3446
run: |
3547
set -euo pipefail
3648
REPO="${{ github.workspace }}"
@@ -49,26 +61,38 @@ jobs:
4961
5062
ts-api-surface:
5163
runs-on: ubuntu-latest
64+
env:
65+
SKIP: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change:typescript-api') || contains(github.event.pull_request.labels.*.name, 'breaking-change:approved') }}
5266
steps:
67+
- name: Skipped — intentional breaking change (label override)
68+
if: env.SKIP == 'true'
69+
run: |
70+
echo "::notice title=TypeScript API check skipped::This PR has label breaking-change:typescript-api or breaking-change:approved. Commit an updated api-baseline.d.ts when appropriate; this label only bypasses CI."
71+
5372
- name: Checkout code
73+
if: env.SKIP != 'true'
5474
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5575
with:
5676
submodules: recursive
5777
token: ${{ secrets.GITHUB_TOKEN }}
5878

5979
- name: Setup Bun
80+
if: env.SKIP != 'true'
6081
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
6182
with:
6283
bun-version: 1.3.12
6384

6485
- name: Install dependencies
86+
if: env.SKIP != 'true'
6587
run: bun install --frozen-lockfile
6688

6789
- name: Compile declaration emit
90+
if: env.SKIP != 'true'
6891
working-directory: packages/cre-sdk
6992
run: bun run compile:build
7093

7194
- name: Diff TypeScript public API vs baseline
95+
if: env.SKIP != 'true'
7296
working-directory: packages/cre-sdk
7397
run: |
7498
cat dist/index.d.ts dist/pb.d.ts \
@@ -83,26 +107,38 @@ jobs:
83107
84108
host-bindings:
85109
runs-on: ubuntu-latest
110+
env:
111+
SKIP: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change:host-bindings') || contains(github.event.pull_request.labels.*.name, 'breaking-change:approved') }}
86112
steps:
113+
- name: Skipped — intentional breaking change (label override)
114+
if: env.SKIP == 'true'
115+
run: |
116+
echo "::notice title=Host bindings check skipped::This PR has label breaking-change:host-bindings or breaking-change:approved. Update snapshots and host-imports-baseline.txt when appropriate; this label only bypasses CI."
117+
87118
- name: Checkout code
119+
if: env.SKIP != 'true'
88120
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
89121
with:
90122
submodules: recursive
91123
token: ${{ secrets.GITHUB_TOKEN }}
92124

93125
- name: Setup Bun
126+
if: env.SKIP != 'true'
94127
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
95128
with:
96129
bun-version: 1.3.12
97130

98131
- name: Install dependencies
132+
if: env.SKIP != 'true'
99133
run: bun install --frozen-lockfile
100134

101135
- name: JS host bindings snapshot test
136+
if: env.SKIP != 'true'
102137
working-directory: packages/cre-sdk
103138
run: bun test src/sdk/wasm/host-bindings-contract.test.ts
104139

105140
- name: Diff Rust host imports vs baseline
141+
if: env.SKIP != 'true'
106142
run: |
107143
sed -n '/unsafe extern "C"/,/^}/p' \
108144
packages/cre-sdk-javy-plugin/src/javy_chainlink_sdk/src/lib.rs \

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,30 @@ bun generate:sdk # Generate all SDK types and code
268268

269269
### Breaking Changes
270270

271-
The `breaking-changes` CI job blocks PRs that alter any of the three protected contracts.
272-
If your change is intentional, update the relevant baseline before pushing:
271+
The [`breaking-changes`](./.github/workflows/breaking-changes.yml) workflow blocks PRs that alter any of the three protected contracts. If your change is intentional, update the relevant baseline before pushing:
273272

274273
| Contract | What triggers the failure | How to update |
275274
|---|---|---|
276-
| Proto fields | Field deleted, renamed, renumbered, or type changed | No baseline file needed — CI runs `buf breaking` on `submodules/chainlink-protos` (`cre` module) against the submodule commit pinned on `main` |
275+
| Proto fields | Field deleted, renamed, renumbered, or type changed | No baseline file — CI runs `buf breaking` on `submodules/chainlink-protos` (`cre` module) against the submodule commit pinned on `main` |
277276
| TypeScript public API | An exported type/interface was removed or changed | Run `bun run update-api-baseline` inside `packages/cre-sdk` and commit `api-baseline.d.ts` |
278277
| JS host binding names | A binding was added, removed, or renamed in `host-bindings.ts` | Run `bun test --update-snapshots` inside `packages/cre-sdk` and commit the updated `__snapshots__` file |
279278
| Rust host imports | An `extern "C"` import was added or removed in `lib.rs` | Re-run the sed extraction (see `breaking-changes.yml`) and commit `host-imports-baseline.txt` |
280279

280+
#### CI override labels
281+
282+
When a change is **intentionally** breaking and cannot be fixed by updating a baseline (e.g. a coordinated proto break before `main` catches up), a **maintainer** adds the matching label on the PR (this re-runs the workflow):
283+
284+
| Label | Skips |
285+
|-------|--------|
286+
| `breaking-change:proto` | `proto-breaking` (`buf breaking`) |
287+
| `breaking-change:typescript-api` | `ts-api-surface` |
288+
| `breaking-change:host-bindings` | `host-bindings` |
289+
| `breaking-change:approved` | All three jobs |
290+
291+
Labels are an audit trail in the PR timeline, not a substitute for review. Prefer updating baselines (`api-baseline.d.ts`, snapshots, `host-imports-baseline.txt`) when the new contract is the new source of truth. For proto breaks, coordinate the `chainlink-protos` submodule bump and document migration notes in the PR.
292+
293+
Restrict who can add these labels in the repo’s **Labels** settings (e.g. maintainers only).
294+
281295
For detailed development setup, see individual package READMEs:
282296

283297
- [CRE SDK Development](./packages/cre-sdk/README.md#building-from-source)

0 commit comments

Comments
 (0)