Repository navigation
fix(ci): Only auto-commit generated backend changes on pull requests - #131262
Merged
Merged
Conversation
BYK
approved these changes
Nov 17, 2026
The requirements, api-url-typescript, and mypy blocklist steps commit through getsentry/action-github-commit, which targets GITHUB_HEAD_REF or falls back to master. Their guard only excluded refs/heads/master, so a merge_group run (ref gh-readonly-queue/master/...) or a workflow_dispatch on another branch would commit straight to master. Gate them on pull_request events, where GITHUB_HEAD_REF is the PR branch. Refs DI-2870 Co-Authored-By: Burak Yigit Kaya <[email protected]>
sentry-junior
Bot
force-pushed
the
ci/gate-autocommit-on-pull-request
branch
from
November 17, 2026 12:56
33e5674 to
dd5f810
Compare
BYK
approved these changes
Nov 18, 2026
BYK
added a commit
that referenced
this pull request
Nov 18, 2026
Stacked on #131262, which has to land first. Without it, `backend.yml`'s auto-commit steps would commit straight to master from merge queue runs. This adds `merge_group: {types: [checks_requested]}` to `backend.yml`, `frontend.yml`, `acceptance.yml`, and `pre-commit.yml`. It also adds `merge_group` to the event allow-list on `acceptance.yml`'s `files-changed` job, which only allowed `pull_request` and `push`. Without that, the acceptance suite would skip on merge groups while `Acceptance` still passed. Together these changes make sure `Backend`, `Frontend`, `Acceptance`, and `pre-commit lint` report on merge queue commits. **No merge queue is configured on master yet, so this does nothing until one is enabled.** `getsentry / backend` needs a separate dispatch change and is not part of this PR. What a `merge_group` run does with the current workflows: - **Change detection:** `dorny/paths-filter` v4.0.2 diffs `merge_group.base_sha..head_sha`, so jobs are path-filtered like push-to-master. In a batched queue, that diff covers every PR in the group. - **Test scope:** `select-tests` is PR-only in both `backend.yml` and `acceptance.yml`, so the backend and acceptance suites run in full, and `backend-migration-tests` runs too. `git-merge-base.sh` exits early on any event other than `pull_request`, so Jest and oxlint run at full scope. That's the right call: with squash merges a merge group commit has no `HEAD^2`, and even with merge commits `HEAD^1..HEAD^2` would miss the other PRs batched ahead of it. - **Required-check jobs** (`Backend`, `Frontend`, `Acceptance`) use `if: always()`. They report even when every job is filtered out. - **Runners:** every runner check falls back to the master runners (x86). - **Concurrency:** `head_ref` is empty, so each group falls back to `run_id`. Queue entries never cancel each other. - **PR-only steps:** the steps that read `github.event.pull_request` are already gated on `pull_request`, or fall back safely when the PR field is empty: selected tests, failure reporting, lint baseline, suppression pruning, and pre-commit autofix (`refs/pull`). - **Lint ratchet:** oxlint runs `lint:suppressions --ci` without `--base`, the same as master. Live debt still has to fit the committed budgets. `report-backend-test-failures` stays PR-only. It posts and cleans up a comment on `context.payload.pull_request`, which a merge group doesn't have. You could parse a PR number out of `merge_group.head_ref`, but in a batched group that names only the last PR, which may not have caused the failure. Its stale-comment cleanup would also delete that PR's own failure report. The queue already links the failing check when it removes an entry. Refs DI-2871 <!-- junior-request-attribution:start --> via @BYK, **michael**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Ad99527799d5e0fe45fe4791535d47143 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Ad99527799d5e0fe45fe4791535d47143) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ad99527799d5e0fe45fe4791535d47143/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Burak Yigit Kaya <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Three steps in
backend.ymlcommit generated changes back throughgetsentry/action-github-commit:requirements(re-freeze),api-url-typescript(URL sync), andtyping(mypy blocklist). They only ran whengithub.ref != 'refs/heads/master'.The action picks its target branch as
process.env.GITHUB_HEAD_REF || 'master'(pinned31f6706,src/main.tsanddist/index.js).GITHUB_HEAD_REFis only set forpull_requestevents. So any non-PR run off master passes the old guard and commits to master:merge_groupruns, where the ref isrefs/heads/gh-readonly-queue/master/.... We're preparing to enable a merge queue, so this has to land first.workflow_dispatchon any branch other than master. This can already happen today.This PR gates the three steps on
github.event_name == 'pull_request'instead. PR behavior doesn't change, and push-to-master already skipped them.pre-commit.yml's autofix step is already gated onstartsWith(github.ref, 'refs/pull'), so it's safe onmerge_groupand I left it alone. No other workflow in the repo usesaction-github-commit.Refs DI-2870
via @BYK.
--
View Session [Sentry]