Skip to content

Close PRs from organization-owned forks - #3

Merged
jasonvarga merged 1 commit into
mainfrom
guard-org-fork-prs
Nov 20, 2026
Merged

jasonvarga merged 1 commit into
mainfrom
guard-org-fork-prs

Conversation

@jasonvarga

Copy link
Copy Markdown
Member

GitHub doesn't allow maintainer edits on PRs from forks owned by organizations, even when "Allow edits by maintainers" is checked. The API can still report maintainerCanModify: true for these PRs, so the existing check lets them through, and then maintainers can't push to the branch. This happened on statamic/cms#15982.

This adds __typename to the headRepositoryOwner query and treats organization-owned forks as uneditable. They get their own comment that explains the organization limitation, since the existing message tells contributors to enable maintainer edits, which they may have already done. PRs from statamic branches are still exempt through the earlier login check.

I checked the last 2,000 merged statamic/cms PRs (111 unique authors), and none came from an organization fork other than statamic, so this wouldn't have closed any of them.

Repos that call this workflow pin it to a commit SHA, so the change won't take effect in statamic/cms until a follow-up PR there bumps the pin to this PR's merge commit.

GitHub doesn't allow maintainer edits on PRs from forks owned by organizations, even though maintainerCanModify can still report true. Check the head repository owner type and close those PRs with a dedicated message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit cdd1c89 into main Nov 20, 2026
4 checks passed
@jasonvarga
jasonvarga deleted the guard-org-fork-prs branch November 20, 2026 20:37
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.

1 participant