Repository navigation
Description
Every pull request from a fork shows a red REST API Tests, and the change being contributed has nothing to do with it. #972 (from wbraithwaite-nvidia) is the live example: a four-line SQL seed, Run API Tests green, and the workflow still failed.
Cause
.github/workflows/api-tests.yml, the benchmark job's last meaningful step:
- name: Comment Benchmark Results on PR
uses: actions/github-script@v9
with:
script: |
github.rest.issues.createComment({ … })No fork guard, no continue-on-error. A pull request from a fork gets a read-only GITHUB_TOKEN regardless of the workflow's permissions: block, so createComment fails:
RequestError [HttpError]: Resource not accessible by integration
https://docs.github.com/rest/issues/comments#create-an-issue-comment
##[error]Unhandled error: HttpError: Resource not accessible by integration
and that takes the whole job with it.
Evidence it is the fork, and nothing else
Step-level outcomes for the same job on two PRs, same workflow, same commit range. #972 is a fork; #973 is a branch in this repo:
| step | #972 (fork) | #973 (same repo) |
|---|---|---|
| Start Supabase | success | success |
| Run Benchmarks | success | success |
| Upload Benchmark Results | success | success |
| Comment Benchmark Results on PR | failure | success |
| Stop Supabase | success | success |
One step differs. Everything before it passed identically.
Why it only started showing up now
benchmark is needs: test inside api-tests.yml, and until #973 a seed-only change could not trigger that workflow at all (packages/supabase/seeds/** was in no path filter). #972 is the first fork PR to reach this job in a while. The breakage is older than its discovery.
Fix
Guard the step on the PR being same-repo:
- name: Comment Benchmark Results on PR
if: github.event.pull_request.head.repo.full_name == github.repository
uses: actions/github-script@v9continue-on-error: true would also stop it failing the build, but silently — and the step is cosmetic, so skipping it deliberately is the honest version. The results are already kept by Upload Benchmark Results as an artifact either way.
Worth checking the same pattern elsewhere: any createComment/createReview in a pull_request-triggered workflow has this defect. pull-requests: write in the permissions: block does not grant it for forks.
Acceptance
- A fork PR touching
packages/supabase/**gets a greenREST API Testswhen its own tests pass. - The benchmark artifact is still uploaded for fork PRs.
- No other
pull_requestworkflow writes to the PR without a same-repo guard.
Found while merging #972 (#966). See also #987 — the benchmark that step is trying to post has never produced any output.
Activity
fix(ci): skip the benchmark PR comment on forks, so fork PRs stop goi…