Skip to content

fix(ci): fix PR comment posting for fork PRs#524

Open
alex-gilin wants to merge 1 commit into
mainfrom
fix/ci-pr-comment-fork-permissions
Open

fix(ci): fix PR comment posting for fork PRs#524
alex-gilin wants to merge 1 commit into
mainfrom
fix/ci-pr-comment-fork-permissions

Conversation

@alex-gilin

Copy link
Copy Markdown
Contributor

Summary

  • GitHub's GITHUB_TOKEN has read-only access for pull_request events from forks, causing the peter-evans/create-or-update-comment step to fail with "Resource not accessible by integration"
  • Split the commenting logic into a separate workflow_run-triggered workflow (pr-comment.yml) that runs in the base repo context where GITHUB_TOKEN has write access
  • The CI workflow now saves PR metadata (PR number, SHA, run ID, artifact ID) as a short-lived artifact; the comment workflow downloads it and posts/updates the PR comment

Follows the pattern recommended by GitHub Security Lab for safely commenting on fork PRs:
https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

Test plan

  • Merge to main and verify a fork PR triggers the PR Build Comment workflow and posts a comment successfully

GitHub's GITHUB_TOKEN has read-only access for pull_request events from
forks, so the peter-evans/create-or-update-comment step was failing with
"Resource not accessible by integration".

Split the commenting logic into a separate workflow_run-triggered workflow
(pr-comment.yml) that runs in the base repo context where GITHUB_TOKEN
has full write access. The CI workflow now saves PR metadata (PR number,
SHA, run ID, artifact ID) as a short-lived artifact which the comment
workflow downloads and uses to post/update the PR comment.
@alex-gilin alex-gilin requested a review from bd82 June 16, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant