ci(preview): grant pull-requests:write so PR comment posts#3663
Merged
Conversation
`peter-evans/create-or-update-comment@v4` uses the issues API endpoint to post general PR comments, but GitHub Actions enforces a separate `pull-requests` scope for any write that targets a pull request. With `pull-requests: read` and only `issues: write`, the action silently no-ops on PRs — the workflow run looks successful, the preview branch gets pushed, but no comment is created. Observed on PR #3661: preview-build succeeded, preview-publish ran far enough to push `preview/pr-3661` with valid metadata, but the comment step produced nothing. The earlier intent ("PR comments go through issues:write") was correct at the API level but not at the Actions permissions level.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the preview-publish workflow silently failing to post the per-PR comment after #3662 landed.
What's broken
On PR #3661,
preview-buildsucceeded andpreview-publishran far enough to push the orphanpreview/pr-3661branch with validmetadata.json— but no comment ever appeared on the PR.Root cause
peter-evans/create-or-update-comment@v4uses the issues API endpoint (POST /repos/{owner}/{repo}/issues/{n}/comments) to post general PR comments. The earlier permissions block reasoned, correctly at the API level, that this only needsissues: write. But GitHub Actions adds an additional layer on top: it enforces a separatepull-requestsscope for any write that targets a pull request, regardless of which underlying API endpoint the action calls.With
pull-requests: read, the action's POST gets silently no-op'd on PRs. The job logs as successful, the preview branch is published, no comment is created.Fix
One-line permission bump from
readtowrite, with an inline comment explaining why this is necessary despite the issues-API rationale.Test plan
preview-buildon an open PR (e.g. by pushing any commit to PR feat(jspsych): add record_session option for high-fidelity replay capture #3661). Thepreview-publishworkflow should post a comment with the jsDelivr URLs.find-commentlooks up by<!-- jspsych-preview-bot -->).https://claude.ai/code/session_01WCetXEmRj6Y2cBVsvYz7vM
Generated by Claude Code