From 128e335297a12bbc142dd60ae69d0b77097318a2 Mon Sep 17 00:00:00 2001 From: Kota Yuhara Date: Sat, 25 Jul 2026 16:36:02 +0900 Subject: [PATCH] fix(ci): don't fail benchmark on fork PRs when an alert fires `fail-on-alert: false` is set, so a performance alert is not supposed to fail the job. But with `comment-on-alert: true` the action tries to POST a PR comment, and pull requests from a fork only get a read-only GITHUB_TOKEN, so the write fails with "Resource not accessible by integration" and takes the whole job down. Only enable the alert comment when the pull request does not come from a fork. Behaviour on push events and on same-repo pull requests is unchanged. Co-Authored-By: Claude Opus 5 --- .github/workflows/benchmark.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 95cf847fe..c270a2c93 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -68,7 +68,11 @@ jobs: tool: 'customSmallerIsBetter' output-file-path: benchmark.json alert-threshold: '130%' - comment-on-alert: true + # Only comment on alert when we can actually write to the repository. + # Pull requests from a fork get a read-only GITHUB_TOKEN, so posting the + # alert comment fails with "Resource not accessible by integration" and + # takes the whole job down, despite `fail-on-alert: false`. + comment-on-alert: ${{ github.event.pull_request.head.repo.fork != true }} fail-on-alert: false # GitHub API token to make a commit comment github-token: ${{ secrets.GITHUB_TOKEN }}