chore: distinguish backport pull requests by title and label (#32381)

This commit is contained in:
andig 2026-08-01 12:54:27 +02:00 • committed by GitHub
parent eb95f2166e
commit 4433480e45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View file

@ -30,8 +30,12 @@ jobs:
pr-label:
name: PR labeling
# bot PRs (dependabot etc.) are skipped: the action rejects non-human actors
# unless allowlisted, and bots already label their own PRs
if: github.event_name == 'pull_request_target' && github.event.pull_request.user.type != 'Bot'
# unless allowlisted, and bots already label their own PRs. backports are
# skipped as well, they carry the backport label and nothing else
if: |
github.event_name == 'pull_request_target' &&
github.event.pull_request.user.type != 'Bot' &&
!startsWith(github.event.pull_request.head.ref, 'backport/')
runs-on: ubuntu-latest
permissions:
contents: read # read base repo for area classification

View file

@ -158,11 +158,15 @@ jobs:
NUMBER: ${{ github.event.issue.number }}
ACTOR: ${{ github.event.comment.user.login }}
run: |
# the release line the branch was cut from, 0.313 for release/0.313.1
line=$(echo "${TARGET#release/}" | cut -d. -f1,2)
# the pull request is authored by the deploy token, so name the requester
url=$(gh pr create \
--base "$TARGET" \
--head "$BRANCH" \
--title "$TITLE" \
--title "$line backport: $TITLE" \
--label backport \
--assignee "$ACTOR" \
--body "Backport of #$NUMBER to \`$TARGET\`, requested by @$ACTOR.")
echo "url=$url" >> "$GITHUB_OUTPUT"