Skip to content

Skip fork PR approval API calls for private repos by checking visibility upfront#647

Merged
mbarbero merged 3 commits into
mainfrom
copilot/fix-issue-635
May 6, 2026
Merged

Skip fork PR approval API calls for private repos by checking visibility upfront#647
mbarbero merged 3 commits into
mainfrom
copilot/fix-issue-635

Conversation

Copilot AI commented May 5, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI requested a review from mbarbero May 6, 2026 09:22
@mbarbero
mbarbero requested review from lukpueh and netomi May 6, 2026 09:28
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>
@mbarbero
mbarbero requested a review from iliescuioana May 6, 2026 09:34
Comment thread otterdog/providers/github/rest/repo_client.py

@lukpueh lukpueh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change by itself looks good and likely won't break anything. I have a slightly harder time to assess, if it is complete wrt to #635. But I'm comfortable in approving. :)

@mbarbero
mbarbero merged commit 046d349 into main May 6, 2026
9 checks passed
@mbarbero
mbarbero deleted the copilot/fix-issue-635 branch May 6, 2026 11:00
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.

Fork PR approval is not allowed for private repositories (new)

3 participants