feat: Add pull request settings to github_repository#3479
Draft
nicolas-grekas wants to merge 2 commits into
Draft
feat: Add pull request settings to github_repository#3479nicolas-grekas wants to merge 2 commits into
nicolas-grekas wants to merge 2 commits into
Conversation
The has_pull_requests and pull_request_creation_policy fields were added to go-github's Repository struct after the v88.0.0 release. Pin to the master pseudo-version until v89 is tagged.
GitHub added two repository settings in February 2026: disabling pull requests entirely (has_pull_requests) and restricting who can open them (pull_request_creation_policy, "all" or "collaborators_only"). has_pull_requests defaults to true so existing repositories keep pull requests enabled. The creation policy is only sent when pull requests are enabled, matching how the merge-commit title/message fields are handled.
|
👋 Hi, and thank you for this contribution! This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can. You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
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.
Resolves #3198
Before the change?
github_repositorycould not manage the repository pull request settings GitHub shipped in February 2026: disabling pull requests entirely, and restricting who can open them.After the change?
Two new arguments on
github_repository(and read-only attributes on thegithub_repositorydata source):has_pull_requests(bool, defaults totrue) — set tofalseto disable pull requests on the repository.pull_request_creation_policy(all/collaborators_only) — restricts who can open pull requests.has_pull_requestsdefaults totrueso existing repositories keep pull requests enabled rather than being silently disabled on the next apply.pull_request_creation_policyis only sent when pull requests are enabled, mirroring how the existingmerge_commit_*/squash_merge_commit_*arguments are gated on their parent toggle.Important
Blocked on a go-github release. The struct fields land in google/go-github#4268, which merged after
v88.0.0.go.modcurrently pins a master pseudo-version so the code compiles; it must be repointed to the eventualv89release before this can merge. This matches the issue's existing Blocked status.Pull request checklist
Does this introduce a breaking change?