Skip to content

Commit 6124472

Browse files
Add breaking change detection CI check
Adds a new 'major-change-check' job to the PR workflow that detects potential breaking changes by comparing the branch against main: 1. Changesets requesting a major version bump 2. OCLIF manifest: removed commands, flags, or flag env vars 3. Zod schemas: removed fields in app/extension config specifications When breaking changes are detected: - A sticky PR comment is posted pinging @Shopify/dev_experience to coordinate inclusion in the next major release - The check fails (red) until a dev_experience team member approves the workflow run via the 'breaking-change-approval' environment gate
1 parent 2f9bc85 commit 6124472

3 files changed

Lines changed: 424 additions & 0 deletions

File tree

.github/workflows/tests-pr.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,45 @@ jobs:
287287
header: Type-diff
288288
message: ${{ steps.type-diff.outputs.report }}
289289
recreate: true
290+
291+
major-change-check:
292+
if: github.event.pull_request.head.repo.full_name == github.repository
293+
name: 'Breaking change detection'
294+
runs-on: ubuntu-latest
295+
timeout-minutes: 30
296+
outputs:
297+
has_breaking_changes: ${{ steps.breaking-changes.outputs.has_breaking_changes }}
298+
report: ${{ steps.breaking-changes.outputs.report }}
299+
steps:
300+
- uses: actions/checkout@v3
301+
with:
302+
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
303+
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
304+
fetch-depth: 1
305+
- name: Setup deps
306+
uses: ./.github/actions/setup-cli-deps
307+
with:
308+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
309+
- name: Build
310+
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
311+
- name: Check for breaking changes
312+
working-directory: workspace
313+
id: breaking-changes
314+
run: pnpm nx run major-change-check
315+
- uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1
316+
if: always() && steps.breaking-changes.outputs.report != ''
317+
with:
318+
header: Breaking-change-detection
319+
message: ${{ steps.breaking-changes.outputs.report }}
320+
recreate: true
321+
322+
major-change-approval:
323+
name: 'Breaking change approval'
324+
needs: major-change-check
325+
if: always() && needs.major-change-check.outputs.has_breaking_changes == 'true'
326+
runs-on: ubuntu-latest
327+
timeout-minutes: 5
328+
environment: breaking-change-approval
329+
steps:
330+
- name: Approved
331+
run: echo '✅ Breaking changes approved by dev_experience team member'

workspace/project.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
"commands": ["node src/type-diff.js"],
2222
"cwd": "workspace"
2323
}
24+
},
25+
"major-change-check": {
26+
"executor": "nx:run-commands",
27+
"dependsOn": ["^build"],
28+
"options": {
29+
"commands": ["node src/major-change-check.js"],
30+
"cwd": "workspace"
31+
}
2432
}
2533
}
2634
}

0 commit comments

Comments
 (0)