Skip to content

Commit a61e5c9

Browse files
authored
Require bot:promote for uv-security PR promotion (#21286)
## Summary Marking a `uv-security` pull request ready for review can currently publish it to the public `uv` repository. Require `bot:promote` as an additional gate; `ready_for_review` remains the trigger. Check the label before requesting promotion credentials, during planning, and before publication, including the final read before pushing private commits. Keep `uv-dev` promotion and existing writer and revision checks unchanged. ## Test plan (on top of CI) Exercised the workflow's shell steps with mocked GitHub and Git commands. Verified missing and unrelated labels block promotion, label removal before the final publication check stops the push, and unlabeled `uv-dev` PRs still proceed. Also covered parent updates and existing upstream branches and PRs.
1 parent 2e7d28b commit a61e5c9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎.github/workflows/promote-pull-request.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ permissions: {}
1717
env:
1818
UV_REPOSITORY_ID: "699532645"
1919
AUTOMATIONS_BOT_ID: "305554984"
20+
UV_SECURITY_PUBLISH_LABEL: "bot:promote"
2021

2122
concurrency:
2223
group: promote-pull-request-${{ inputs.pull_request }}
@@ -128,6 +129,10 @@ jobs:
128129
echo "approval_id=$(jq --raw-output '.id' <<< "$approval")" >> "$GITHUB_OUTPUT"
129130
130131
if [ "$GITHUB_REPOSITORY" = "astral-sh/uv-security" ]; then
132+
if ! jq --exit-status --arg label "$UV_SECURITY_PUBLISH_LABEL" \
133+
'.labels | any(.name == $label)' <<< "$source_pull_request" > /dev/null; then
134+
reject "The private pull request requires the $UV_SECURITY_PUBLISH_LABEL label."
135+
fi
131136
promoter_permission=$(gh api --method GET "repos/$GITHUB_REPOSITORY/collaborators/$promoter/permission")
132137
if ! jq --exit-status \
133138
'.permission == "admin" or .permission == "maintain" or .permission == "write"' \
@@ -465,6 +470,10 @@ jobs:
465470
fi
466471
467472
if [ "$GITHUB_REPOSITORY" = "astral-sh/uv-security" ]; then
473+
if ! jq --exit-status --arg label "$UV_SECURITY_PUBLISH_LABEL" \
474+
'.labels | any(.name == $label)' <<< "$source_pull_request" > /dev/null; then
475+
reject "The private pull request requires the $UV_SECURITY_PUBLISH_LABEL label."
476+
fi
468477
promoter_permission=$(gh api --method GET "repos/$GITHUB_REPOSITORY/collaborators/$PROMOTER/permission")
469478
if ! jq --exit-status \
470479
'.permission == "admin" or .permission == "maintain" or .permission == "write"' \
@@ -568,6 +577,10 @@ jobs:
568577
<<< "$current_pull_request" > /dev/null; then
569578
reject "The private pull request or its approval changed before publication."
570579
fi
580+
if ! jq --exit-status --arg label "$UV_SECURITY_PUBLISH_LABEL" \
581+
'.labels | any(.name == $label)' <<< "$current_pull_request" > /dev/null; then
582+
reject "The private pull request requires the $UV_SECURITY_PUBLISH_LABEL label."
583+
fi
571584
572585
promotion_git push --force-with-lease="refs/heads/$HEAD_REF:" \
573586
https://github.com/astral-sh/uv.git "$PROMOTED_HEAD:refs/heads/$HEAD_REF"

0 commit comments

Comments
 (0)