Skip to content

Every fork PR fails REST API Tests on a cosmetic step: the benchmark comment needs a same-repo guard #986

Closed

Description

@thinkclay

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@v9

continue-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 green REST API Tests when its own tests pass.
  • The benchmark artifact is still uploaded for fork PRs.
  • No other pull_request workflow 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

  1. added
    agent-ready
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Backendagent-ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions