feat: Add github_repository_pull_request_creation_policy resource#3349
feat: Add github_repository_pull_request_creation_policy resource#3349RoFz wants to merge 2 commits intointegrations:mainfrom
Conversation
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
6f14748 to
4d4fe11
Compare
deiga
left a comment
There was a problem hiding this comment.
The github_repository resource relies solely on the REST API currently. If you need to use GQL API, then please do that in a separate resource.
- refactor: extract pull_request_creation_policy into github_repository_pull_request_creation_policy resource - refactor: revert pull_request_creation_policy field and GraphQL calls from github_repository - refactor: remove isUnsupportedPullRequestCreationPolicyError; dedicated resource fails loudly on missing API field - feat: add github_repository_pull_request_creation_policy resource with GraphQL CRUD and import - test: add acceptance tests for github_repository_pull_request_creation_policy - docs: add documentation for github_repository_pull_request_creation_policy
4d4fe11 to
efeb9d4
Compare
RoFz
left a comment
There was a problem hiding this comment.
Thanks for the review. Reworked to a dedicated github_repository_pull_request_creation_policy resource that uses only the GraphQL API, keeping github_repository REST-only.
Resolves #3348
Before the change?
github_repositorycould not managepull_request_creation_policy.After the change?
github_repository_pull_request_creation_policyresource that manages the pull request creation policy for a repository via the GitHub GraphQL API.allandcollaborators_onlyvalues.Why a separate resource?
github_repositoryuses only the REST API. BecausepullRequestCreationPolicyis only exposed via GraphQL, this change follows the existing pattern used by other GraphQL-backed resources in this provider (e.g.github_team_settings,github_branch_protection) and introduces a dedicated resource rather than mixing transport layers ingithub_repository.Evidence
go test ./github -run 'TestPullRequestCreationPolicyMapping|TestRepositoryPullRequestCreationPolicyGraphQL' -count=1make testGH_TEST_AUTH_MODE=individual GITHUB_OWNER=RoFz GITHUB_USERNAME=RoFz make testacc T='TestAccGithubRepositoryPullRequestCreationPolicy'make lintchecktf-pr-creation-policy-manual-20260419-120606:terraform applysucceeded, GitHub API readback returnedcollaborators_only, and a follow-upterraform plan -detailed-exitcodereturned no changes.Pull request checklist
Does this introduce a breaking change?