Skip fork PR approval API calls for private repos by checking visibility upfront#647
Merged
Conversation
… exceptions Agent-Logs-Url: https://github.com/eclipse-csi/otterdog/sessions/7a7e39a1-6243-4958-8653-fa287e9c1984 Co-authored-by: mbarbero <452625+mbarbero@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
mbarbero
May 5, 2026 08:21
View session
mbarbero
marked this pull request as ready for review
May 5, 2026 08:30
Agent-Logs-Url: https://github.com/eclipse-csi/otterdog/sessions/1482d63e-2094-408b-a24e-976c6be5be0c Co-authored-by: mbarbero <452625+mbarbero@users.noreply.github.com>
Agent-Logs-Url: https://github.com/eclipse-csi/otterdog/sessions/a70a49b3-1b42-4321-9002-b8d3359868a2 Co-authored-by: mbarbero <452625+mbarbero@users.noreply.github.com>
lukpueh
reviewed
May 6, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Root cause: GitHub's API returns a 422 "Validation Failed – Fork PR approval is not allowed for private repositories" when _get_fork_pr_approval_policy (and _update_fork_pr_approval_policy) are called on a private repo. The current code unconditionally raises a RuntimeError on any GitHubException, which surfaces as a hard failure.
Approach: Check whether the repo is private before calling the fork-pr-contributor-approval endpoint — the same pattern already used in get_repo_data (line 83-85)
Fixes #635