Skip to content

Commit f4362a2

Browse files
committed
fix(ci): run the perf comment upsert from the base commit
The comment job holds `pull-requests: write` and `issues: write`, but it checked out the PR merge commit and ran that tree's setup action and `upsert-pr-comment.nu`, so a PR that edited either ran them with the write token. Check out `pull_request.base.sha` instead, still without persisted credentials. The PR's report reaches the job only as an artifact the script reads as text. This PR does not change `upsert-pr-comment.nu`, and the base version reads the same inputs (COMMENT_FILE as raw markdown, COMMENT_MARKER, PR_NUMBER, GITHUB_REPOSITORY, GITHUB_TOKEN), so the first runs after merge need no fallback. The workflow file itself still comes from the PR on `pull_request` events, so this removes the PR's scripts from the write job rather than making the job a hard trust boundary. Reported by CodeRabbit on #2061.
1 parent cd33a07 commit f4362a2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,13 @@ jobs:
580580
runs-on: blacksmith-32vcpu-ubuntu-2404
581581
timeout-minutes: 10
582582
steps:
583-
- name: Checkout PR merge commit
583+
# The write token must not reach code the PR edited, so the action and
584+
# the upsert script come from the base commit; the downloaded report is
585+
# only passed to the script as text.
586+
- name: Checkout base commit
584587
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
585588
with:
589+
ref: ${{ github.event.pull_request.base.sha }}
586590
persist-credentials: false
587591

588592
- uses: ./.github/actions/setup-nix-cache

0 commit comments

Comments
 (0)