Skip to content

Commit e4b00f6

Browse files
authored
ci: fix release-pr-approvals for forks (#1150)
Follow-up for #1144. Release please PRs are never created from forks, so running on `pull_request_review` (which has only readonly access for PRs from forks) will never need to post a commit status. Such cases are skipped now instead of failing (i.e. [here](https://github.com/a2aproject/a2a-js/actions/runs/30247915633/job/89919011242?pr=602)).
1 parent 086d70f commit e4b00f6

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

.github/workflows/release-pr-approvals.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ jobs:
3737
const pr = context.payload.pull_request;
3838
const { owner, repo } = context.repo;
3939
40+
// pull_request_review runs on a fork PR get a read-only GITHUB_TOKEN,
41+
// so createCommitStatus would 403. Release PRs are always created in
42+
// this repo (release-please pushes release-please--* to the base repo,
43+
// never a fork), so their review events keep a write token. Every other
44+
// PR already gets its status from the pull_request_target run, which
45+
// has a write token even for forks. So skip fork review events.
46+
const isReviewEvent = context.eventName === 'pull_request_review';
47+
const isFork = pr.head.repo?.full_name !== `${owner}/${repo}`;
48+
if (isReviewEvent && isFork) {
49+
core.info('Fork review event has a read-only token; status handled by pull_request_target.');
50+
return;
51+
}
52+
4053
const setStatus = (state, description) =>
4154
github.rest.repos.createCommitStatus({
4255
owner, repo, sha: pr.head.sha, context: CONTEXT, state, description,

0 commit comments

Comments
 (0)