Skip to content

Skip PR artifact comment job on fork PRs - #134

Merged
peterjaap merged 1 commit into
qoliber:mainfrom
Aquive:fix/ci-skip-artifact-comment-on-forks
Aug 7, 2026
Merged

Skip PR artifact comment job on fork PRs#134
peterjaap merged 1 commit into
qoliber:mainfrom
Aquive:fix/ci-skip-artifact-comment-on-forks

Conversation

@Aquive

@Aquive Aquive commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

The Comment PR with artifact links job fails on every PR from a fork with 403 Resource not accessible by integration. It asks for pull-requests: write, but GitHub caps GITHUB_TOKEN to read-only for pull_request runs from a fork — requesting the permission cannot override that. The run goes red even though all builds, tests and lint pass.

It's not flaky: always fails for fork PRs, never for PRs from branches in this repo. Since most PRs here come from qoliber branches, it just looks intermittent. Introduced in 1fe4817#111 was green from a fork the day before; #123 (external contributor), #128 and #133 all failed on this job since.

The fix gates the job on the PR coming from this repo:

if: github.event.pull_request.head.repo.full_name == github.repository

On push events github.event.pull_request is null, so the job is still skipped — this covers the old github.event_name == 'pull_request' guard.

This PR is itself from a fork, so green CI here is the proof it works.

Trade-off: fork PRs lose the artifact-links comment (today they never get it anyway). The real fix is a workflow_run trigger, which runs with a writable token — left out because it only takes effect after merge and can't demonstrate itself in a PR. Happy to open that separately.

The comment-artifacts job requests pull-requests: write, but GitHub caps
GITHUB_TOKEN to read-only for pull_request runs originating from a fork.
Posting the comment therefore fails with 403 'Resource not accessible by
integration', marking the whole run as failed even when every build, test
and lint job passed.

This has broken every fork PR since 1fe4817 added the job (qoliber#128, qoliber#133, and
external contributions such as qoliber#123). PRs from branches in this repository
are unaffected and keep their artifact comment.

Gate the job on the PR originating from this repository instead of merely
being a pull_request. On push events github.event.pull_request is null, so
the job is still skipped there, matching the previous guard.
@peterjaap
peterjaap merged commit 5063815 into qoliber:main Aug 7, 2026
10 checks passed
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