-
Notifications
You must be signed in to change notification settings - Fork 262
Allow code-owner approval to override breaking-change check #7469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alfonso-noriega
wants to merge
5
commits into
main
Choose a base branch
from
breaking-change-codeowner-override
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+624
−51
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2a7b3ea
Allow code-owner approval to override breaking-change check
alfonso-noriega 18949c2
Fix breaking-change-check: restore fetch-depth: 0 for merge-base diff
alfonso-noriega d4e0ca5
Address review: preserve override sticky comment, ignore COMMENTED re…
alfonso-noriega 67b3e88
Plumb repo + prNumber through resolveContext; drop redundant build step
alfonso-noriega 0511a7e
Address second review pass: trigger hygiene, guards, dead code
alfonso-noriega File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: Breaking change check | ||
|
|
||
| # Runs the breaking-change detector on PR opens, updates, AND on review | ||
| # submissions. Re-running on review submissions lets the script flip from | ||
| # red to green when a code-owner approves the PR — see the override logic | ||
| # in workspace/src/major-change-check.js. | ||
| # | ||
| # Lives in a dedicated workflow so review events don't re-trigger the full | ||
| # unit/e2e/type-diff suite. | ||
| on: | ||
| pull_request: | ||
| pull_request_review: | ||
| # Only state-changing actions are interesting: `edited` fires when a | ||
| # review's body text is mutated, which doesn't affect approval state. | ||
| types: [submitted, dismissed] | ||
| merge_group: | ||
|
|
||
| concurrency: | ||
| group: shopify-cli-breaking-change-${{ github.event.pull_request.number || github.event.merge_group.head_sha || github.run_id }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| DEBUG: '1' | ||
| SHOPIFY_CLI_ENV: development | ||
| SHOPIFY_CONFIG: debug | ||
| PNPM_VERSION: '10.11.1' | ||
| BUNDLE_WITHOUT: 'test:development' | ||
| GH_TOKEN: ${{ secrets.SHOPIFY_GH_READ_CONTENT_TOKEN }} | ||
| GH_TOKEN_SHOP: ${{ secrets.SHOP_GH_READ_CONTENT_TOKEN }} | ||
| DEFAULT_NODE_VERSION: '26.1.0' | ||
|
|
||
| jobs: | ||
| major-change-check: | ||
| # Skip fork PRs — fork tokens are read-only and the codeowner-override | ||
| # API calls would fail. | ||
| if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'merge_group' | ||
| name: 'Breaking change detection' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }} | ||
| ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} | ||
| # Full history so `git merge-base origin/<base> HEAD` (used by | ||
| # major-change-check.js to scope the diff to PR-only changes) can | ||
| # reach the divergence point. With fetch-depth: 1 the merge-base | ||
| # call fails and the script falls back to scanning everything, | ||
| # surfacing every pre-existing major changeset as "new". | ||
| fetch-depth: 0 | ||
| - name: Setup deps | ||
| uses: ./.github/actions/setup-cli-deps | ||
| with: | ||
| node-version: ${{ env.DEFAULT_NODE_VERSION }} | ||
| # No build step: major-change-check.js operates on git-tracked | ||
| # source files (.ts, oclif.manifest.json, .changeset/*.md) and | ||
| # `git diff` output only — it never imports built artefacts. The | ||
| # script itself explicitly opts out of installing/building the | ||
| # baseline checkout for the same reason (see runMain in | ||
| # workspace/src/major-change-check.js). Skipping the build keeps | ||
| # approval-triggered re-runs fast (~30s instead of ~5–8min) so the | ||
| # check can flip green quickly when a code owner approves. | ||
| - name: Check for breaking changes | ||
| id: check | ||
| env: | ||
| # The default GITHUB_TOKEN can read PR reviews and the repo's | ||
| # CODEOWNERS file, which is all the override needs. | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: node workspace/src/major-change-check.js | ||
| - uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1 | ||
| if: steps.check.outputs.has_breaking_changes == 'true' | ||
| with: | ||
| header: Breaking-change-detection | ||
| message: ${{ steps.check.outputs.report }} | ||
| recreate: true | ||
| # Override granted: breaking changes were detected but a code-owner | ||
| # approved, so we keep the sticky comment up to record the override | ||
| # footer ("✅ Override: approved by @user") emitted by the script. | ||
| - uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1 | ||
| if: steps.check.outputs.has_breaking_changes != 'true' && steps.check.outputs.report != '' | ||
| with: | ||
| header: Breaking-change-detection | ||
| message: ${{ steps.check.outputs.report }} | ||
| recreate: true | ||
| # No breaking changes at all: delete any stale sticky comment from a | ||
| # previous push. | ||
| - uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1 | ||
| if: steps.check.outputs.has_breaking_changes != 'true' && steps.check.outputs.report == '' | ||
| with: | ||
| header: Breaking-change-detection | ||
| delete: true | ||
| - name: Fail if breaking changes detected | ||
| if: steps.check.outputs.has_breaking_changes == 'true' | ||
| run: | | ||
| echo '::error::Breaking changes detected. See the sticky comment on the PR for details. A code-owner approval on this PR will turn this check green.' | ||
| exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.