Skip to content

fix: skip coverage PR comment for fork pull requests - #51

Merged
rracariu merged 1 commit into
masterfrom
fix/coverage-comment-fork-prs
Nov 5, 2026
Merged

rracariu merged 1 commit into
masterfrom
fix/coverage-comment-fork-prs

Conversation

@rracariu

@rracariu rracariu commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The Code Coverage job fails on pull requests from forks, as seen on #50:

##[error]Resource not accessible by integration

Coverage generates correctly. Only the final Report coverage on PR step fails, when it tries to post its comment. GitHub gives pull_request workflows from forks a read-only GITHUB_TOKEN, so the job's pull-requests: write request isn't honored.

Change

Run the comment step only when the PR branch is in this repository. Fork PRs skip the comment, and the HTML coverage report is still uploaded as an artifact.

pull_request_target would provide a write token, but this job builds and runs the PR's code, so a fork could get hold of that token.

Testing

🤖 Generated with Claude Code

GitHub gives pull_request workflows from forks a read-only GITHUB_TOKEN,
regardless of the permissions the workflow requests. The comment step then
fails with "Resource not accessible by integration", which fails the
coverage job even though coverage was generated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Coverage after merging fix/coverage-comment-fork-prs into master will be

82.54%

Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines

@rracariu
rracariu requested a review from garethj2 November 5, 2026 18:03
@rracariu
rracariu merged commit fd8fe82 into master Nov 5, 2026
10 checks passed
@rracariu
rracariu deleted the fix/coverage-comment-fork-prs branch November 5, 2026 18:59
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.

2 participants