@@ -287,3 +287,65 @@ 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.read-results.outputs.has_breaking_changes }}
298+ steps :
299+ - uses : actions/checkout@v3
300+ with :
301+ repository : ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
302+ ref : ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
303+ fetch-depth : 1
304+ - name : Setup deps
305+ uses : ./.github/actions/setup-cli-deps
306+ with :
307+ node-version : ${{ env.DEFAULT_NODE_VERSION }}
308+ - name : Build
309+ run : pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
310+ - name : Check for breaking changes
311+ working-directory : workspace
312+ run : pnpm nx run major-change-check
313+ - name : Read results
314+ id : read-results
315+ run : |
316+ HAS_BREAKING=$(cat workspace/has-breaking-changes)
317+ echo "has_breaking_changes=$HAS_BREAKING" >> "$GITHUB_OUTPUT"
318+ if [ "$HAS_BREAKING" = "true" ] && [ -f workspace/breaking-changes-report.md ]; then
319+ {
320+ echo 'report<<BREAKING_CHANGES_EOF'
321+ cat workspace/breaking-changes-report.md
322+ echo 'BREAKING_CHANGES_EOF'
323+ } >> "$GITHUB_OUTPUT"
324+ fi
325+ - uses : marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1
326+ if : steps.read-results.outputs.has_breaking_changes == 'true'
327+ with :
328+ header : Breaking-change-detection
329+ message : ${{ steps.read-results.outputs.report }}
330+ recreate : true
331+ - uses : marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1
332+ if : steps.read-results.outputs.has_breaking_changes != 'true'
333+ with :
334+ header : Breaking-change-detection
335+ delete : true
336+ - name : Fail if breaking changes detected
337+ if : steps.read-results.outputs.has_breaking_changes == 'true'
338+ run : |
339+ echo '::error::Breaking changes detected. A member of @shopify/dev_experience must approve the breaking-change-approval environment.'
340+ exit 1
341+
342+ major-change-approval :
343+ name : ' Breaking change approval'
344+ needs : major-change-check
345+ if : always() && needs.major-change-check.outputs.has_breaking_changes == 'true'
346+ runs-on : ubuntu-latest
347+ timeout-minutes : 5
348+ environment : breaking-change-approval
349+ steps :
350+ - name : Approved
351+ run : echo '✅ Breaking changes approved by dev_experience team member'
0 commit comments