Skip to content

Commit 310df35

Browse files
Merge pull request #7351 from Shopify/major-change-check
Add breaking change detection CI check
2 parents 6b26d5c + b1f3fe3 commit 310df35

4 files changed

Lines changed: 786 additions & 5 deletions

File tree

.github/workflows/tests-pr.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,53 @@ jobs:
291291
header: Type-diff
292292
message: ${{ steps.type-diff.outputs.report }}
293293
recreate: true
294+
295+
major-change-check:
296+
if: github.event.pull_request.head.repo.full_name == github.repository
297+
name: 'Breaking change detection'
298+
runs-on: ubuntu-latest
299+
timeout-minutes: 30
300+
outputs:
301+
has_breaking_changes: ${{ steps.check.outputs.has_breaking_changes }}
302+
steps:
303+
- uses: actions/checkout@v3
304+
with:
305+
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
306+
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
307+
fetch-depth: 1
308+
- name: Setup deps
309+
uses: ./.github/actions/setup-cli-deps
310+
with:
311+
node-version: ${{ env.DEFAULT_NODE_VERSION }}
312+
- name: Build
313+
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
314+
- name: Check for breaking changes
315+
id: check
316+
run: node workspace/src/major-change-check.js
317+
- uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1
318+
if: steps.check.outputs.has_breaking_changes == 'true'
319+
with:
320+
header: Breaking-change-detection
321+
message: ${{ steps.check.outputs.report }}
322+
recreate: true
323+
- uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1
324+
if: steps.check.outputs.has_breaking_changes != 'true'
325+
with:
326+
header: Breaking-change-detection
327+
delete: true
328+
- name: Fail if breaking changes detected
329+
if: steps.check.outputs.has_breaking_changes == 'true'
330+
run: |
331+
echo '::error::Breaking changes detected. A member of @shopify/dev_experience must approve the breaking-change-approval environment.'
332+
exit 1
333+
334+
major-change-approval:
335+
name: 'Breaking change approval'
336+
needs: major-change-check
337+
if: always() && needs.major-change-check.outputs.has_breaking_changes == 'true'
338+
runs-on: ubuntu-latest
339+
timeout-minutes: 5
340+
environment: breaking-change-approval
341+
steps:
342+
- name: Approved
343+
run: echo '✅ Breaking changes approved by dev_experience team member'

0 commit comments

Comments
 (0)