This repository was archived by the owner on Aug 31, 2026. It is now read-only.
fix(ci): stop the endpoint audit failing every fork pull request - #367
Closed
georgeglarson wants to merge 1 commit into
Closed
fix(ci): stop the endpoint audit failing every fork pull request#367georgeglarson wants to merge 1 commit into
georgeglarson wants to merge 1 commit into
Conversation
A pull_request event raised from a fork runs with a read-only GITHUB_TOKEN, so the workflow's `pull-requests: write` grant cannot be honoured and the report's comment POST returns 403 "Resource not accessible by integration". The step is `if: always()`, so that 403 failed the whole endpoint-audit check on every fork PR regardless of what the audit itself found. Two PRs are sitting on it right now: OpenHands#320, approved and 27 days old, and OpenHands#362, where the audit ran clean (0 actionable client-only calls) and the job still went red on the comment step. The report still has to reach a reviewer, so it now always goes to the job summary, and the comment is attempted only when the run's token can write one. That also covers push events, which have no PR to comment on at all. Verified against the report this repo actually produces: driving the real .audit/endpoint-audit.json through a fork pull_request context throws "Resource not accessible by integration" on the old script and completes with the summary written on the new one. Tooling tests cover same-repo, fork, push and missing-report; audit:endpoints, format:check green.
georgeglarson
marked this pull request as ready for review
August 29, 2026 09:21
neubig
requested review from
all-hands-bot
and removed request for
all-hands-bot
August 29, 2026 13:49
Contributor
|
🤖 OpenHands is reviewing this PR. Head commit: This comment was posted by an AI agent (OpenHands). |
all-hands-bot
removed their request for review
August 29, 2026 13:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN: Ran the endpoint audit and the tooling tests on this branch, both green. Drove the real
.audit/endpoint-audit.jsonthrough a fork pull_request context against both versions of the script: the one on main throwsResource not accessible by integrationand reds the job, this branch writes the job summary, logs the skip and completes.Why
A
pull_requestraised from a fork runs with a read-onlyGITHUB_TOKEN, so the workflow'spull-requests: writegrant cannot be honoured and the report's comment POST comes back403 Resource not accessible by integration. The step isif: always(), so that 403 fails the wholeendpoint-auditcheck on every fork pull request, whatever the audit itself found.Two are sitting on it now. #320 is approved and 27 days old. On #362 the audit ran clean, 0 actionable client-only calls, and the job still went red on the comment step.
Push events have no PR to comment on at all, so
context.issue.numberis undefined there and the same guard covers them.Summary
pull_request.pull_request-only condition so push runs publish the summary too.No permission change and no move to
pull_request_target. The 403 is not swallowed: a same-repo run that cannot comment still fails loudly.Issue Number
No issue filed. Reproducible on any fork PR, most recently on #362: https://github.com/OpenHands/typescript-client/actions/runs/33214568712/job/98995208868
How to Test
npm ci npm run audit:endpoints # writes the real .audit/endpoint-audit.json npm run test:endpoint-audit-toolingThe tooling tests cover four cases: a same-repo PR comments and writes the summary, a fork writes the summary and never calls the comment API, a push behaves like the fork case, and a missing report still warns with nothing published.
To see the failure and the fix against the report this repo actually produces, drive
postEndpointAuditReportwith a forkpull_requestcontext (head repo different from the base) and acreateCommentthat throws a 403. The version onmainthrows out of the step and reds the job. This branch writes the summary, logs the skip, and completes.Video/Screenshots
Type
Notes
canCommentOnPullRequestis exported alongside the existing helpers so the guard can be exercised directly.