Skip to content

Fix: handle 403 gracefully on fork PRs in pr_validation#80

Open
hdamker wants to merge 1 commit intocamaraproject:mainfrom
hdamker:fix/fork-pr-403
Open

Fix: handle 403 gracefully on fork PRs in pr_validation#80
hdamker wants to merge 1 commit intocamaraproject:mainfrom
hdamker:fix/fork-pr-403

Conversation

@hdamker
Copy link
Contributor

@hdamker hdamker commented Feb 18, 2026

What type of PR is this?

bug

What this PR does / why we need it:

The pr_validation workflow crashes when a fork PR changes release-plan.yaml. The createCommitStatus() API call fails with HTTP 403 because GITHUB_TOKEN has insufficient permissions for fork-initiated PRs. The validation itself passes, but the unhandled error causes the job to fail.

This wraps the createCommitStatus() call in a try-catch block. On 403, it logs a warning with the validation result instead of crashing. Other errors are re-thrown. MegaLinter in the same workflow already handles 403s gracefully — this aligns the release-plan validation step.

Which issue(s) this PR fixes:

Fixes #76

Special notes for reviewers:

The fix is minimal: only the createCommitStatus() call is wrapped. The rest of the step (error annotations, job summary, core.setFailed) writes to workflow logs/summary, not to the repo API, so it works fine with fork PR tokens.

Changelog input

 release-note
Fix: pr_validation no longer crashes on fork PRs that change release-plan.yaml

Additional documentation

This section can be blank.

docs

Wrap createCommitStatus() call in try-catch to handle 403 errors
that occur when GITHUB_TOKEN has insufficient permissions for fork
PRs. Logs a warning instead of crashing the job. Other errors are
re-thrown. Fixes camaraproject#76.
@hdamker
Copy link
Contributor Author

hdamker commented Feb 18, 2026

@rartych that is exactly the reason why some PRs show the Megalinter result other not: the Megalinter is also getting the 403 due to missing write permission, but handles them gracefully, while the release-plan.yaml currently exists with code 1.

After the merge, the v0 tag need to be moved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate-release-plan action crashes on fork PRs due to unhandled status API 403

1 participant

Comments