Skip to content

fix(ci): grant pull-requests write so the preview comment can post - #174

Merged
StephenTangCook merged 1 commit into
mainfrom
claude/cf-preview-comment-perms
Aug 4, 2026
Merged

fix(ci): grant pull-requests write so the preview comment can post#174
StephenTangCook merged 1 commit into
mainfrom
claude/cf-preview-comment-perms

Conversation

@StephenTangCook

@StephenTangCook StephenTangCook commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes the workflow added in #173, which has been failing on every Cloudflare check run since it merged.

What happened

The job resolved the PR fine and then died posting the comment:

message: 'Resource not accessible by integration'
x-accepted-github-permissions: 'issues=write; pull_requests=write'
status: '403'

Commenting on a PR goes through the issue-comments endpoint, and GitHub requires both grants for it. The semicolon in that header means AND, not OR. I had trimmed pull-requests to read when adapting the workflow from tightknit-app, on the reasoning that the job only reads PRs via pulls.list. That is true of the listing call and wrong for the comment call, and the original had pull-requests: write for exactly this reason.

My dry-run stubbed Octokit, so it exercised the branching and the comment body but never the permission model. That is the gap this fixes.

Incidental confirmation

This is the same endpoint and the same 403 the Cloudflare app itself is almost certainly hitting. Its installation carries pull_requests: write and no issues grant at all, which is exactly the half-permission shape that produces this error. Worth keeping in mind if anyone wants to restore Cloudflare's own comment rather than rely on this workflow.

Verification

The permission model can only really be tested by running it, so the proof is the next Cloudflare build after this merges. Expect the comment on the first PR that builds, and the workflow's failed runs to stop.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The job could list PRs but not comment on one, so every Cloudflare check run
failed the workflow with 403 `Resource not accessible by integration`. GitHub
answers that request with `x-accepted-github-permissions: issues=write;
pull_requests=write` — semicolon, so both grants are required, and I had
trimmed pull-requests to read when adapting this from tightknit-app.

Same endpoint and same 403 the Cloudflare app itself is almost certainly
hitting: its installation carries `pull_requests: write` with no `issues`
grant at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@StephenTangCook
StephenTangCook merged commit c388a24 into main Aug 4, 2026
14 checks passed
@StephenTangCook
StephenTangCook deleted the claude/cf-preview-comment-perms branch August 4, 2026 17:48
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