Skip to content

Commit 875812c

Browse files
committed
ci: read the labeler's config from the default branch too
backport-auto-label.yml pins `base.sha`, which is main's tip at the pull request's last synchronize rather than now. On a PR nobody has pushed to since apache#6941 that predates release-branches.yml and its parser, so the step below it dies with a file-not-found. It has done so 20 times in production since 2026-07-28. It was survivable while this was only a labeler: a red advisory check on a PR nobody was waiting on. It stops being survivable with the approvals gate in place, because the two failures compose in the worst direction — a labeler that dies applies no `release/*` label, Backport Approvals then finds nothing to approve and passes, and the fix is silently never backported. That is the false record the gate exists to prevent, reached from the side rather than through it. Same one-line repair as the gate: read the default branch, which always carries the config and, being no part of the pull request, is as safe to check out under `pull_request_target` as the base was.
1 parent 4bdfa66 commit 875812c

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

‎.github/workflows/backport-auto-label.yml‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,24 @@ jobs:
6868
if: ${{ github.event.pull_request.base.ref == 'main' }}
6969
runs-on: ubuntu-latest
7070
steps:
71-
# Check out the base commit (a trusted commit already on main) so the
72-
# release-branches config and its parser come from the base repo, never
73-
# from the (untrusted) PR head. pull_request_target runs with write
74-
# permissions, so we must not execute PR-controlled code here.
75-
- name: Checkout base
71+
# The default branch, so the release-branches config and its parser come
72+
# from a ref that does not derive from the pull request at all —
73+
# pull_request_target runs with write permissions, so PR-controlled code
74+
# must never execute here.
75+
#
76+
# `base.sha` was the previous choice and is not safe for a different
77+
# reason: it is main's tip at the PR's last synchronize, not now, so on a
78+
# PR nobody has pushed to since #6941 it predates release-branches.yml and
79+
# the step below dies with a file-not-found. That has failed 20 times in
80+
# production since 2026-07-28. It is survivable here only because this
81+
# check is not required — but a labeler that dies applies no `release/*`
82+
# label, Backport Approvals then has nothing to approve and passes, and the
83+
# fix is silently never backported: the false record that check exists to
84+
# prevent, arriving from this side instead.
85+
- name: Checkout the default branch
7686
uses: actions/checkout@v7
7787
with:
78-
ref: ${{ github.event.pull_request.base.sha }}
88+
ref: ${{ github.event.repository.default_branch }}
7989
persist-credentials: false
8090

8191
- name: Read release branches

0 commit comments

Comments
 (0)