Skip to content

[BUG]: have an option to set org level forking policy#3087

Closed
lee2sh wants to merge 4 commits intointegrations:mainfrom
lee2sh:lee2sh/org-forking-option
Closed

[BUG]: have an option to set org level forking policy#3087
lee2sh wants to merge 4 commits intointegrations:mainfrom
lee2sh:lee2sh/org-forking-option

Conversation

@lee2sh
Copy link
Copy Markdown

@lee2sh lee2sh commented Jan 16, 2026

Resolves #ISSUE_NUMBER


Before the change?

When managing a repository in an organization that has disabled forking, setting allow_forking on the github_repository resource would cause API errors (HTTP 422) because the GitHub API rejects the allow_forking parameter when the organization doesn't permit forking.

After the change?

Added a new org_allow_forking attribute (defaults to true) that controls whether the allow_forking setting is sent to the Github API. When org_allow_forking = false, the provider skips sending allow_forking to the API, preventing errors for organizations that have disabled forking

Pull request checklist

  • Schema migrations have been created if needed (example)
  • [X ] Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@github-actions
Copy link
Copy Markdown

👋 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 Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@lee2sh lee2sh changed the title fix: have an option to set org level forking policy [BUG] fix: have an option to set org level forking policy Jan 16, 2026
@lee2sh lee2sh changed the title [BUG] fix: have an option to set org level forking policy [BUG] have an option to set org level forking policy Jan 17, 2026
@lee2sh lee2sh changed the title [BUG] have an option to set org level forking policy [BUG]: have an option to set org level forking policy Jan 17, 2026
Copy link
Copy Markdown
Collaborator

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

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

I don't think the PR is necessary, nor do I think the UX works.

FYI #3094 fixes this issue as it's just an implementation bug.

@lee2sh
Copy link
Copy Markdown
Author

lee2sh commented Jan 19, 2026

I don't think the PR is necessary, nor do I think the UX works.

FYI #3094 fixes this issue as it's just an implementation bug.

The PR has an edge case. If a user explicitly sets allow_forking (true or false) on an organization that has disabled private repo forking, they'll likely still get a 422 error. The GetOk() fix only handles the case where allow_forking is unset. I believe with this approach, it would proactively respect org settings by omitting the field from the request entirely.

@stevehipwell
Copy link
Copy Markdown
Collaborator

@lee2sh the GitHub API and therefore this provider are full of edge cases. This PR just moves the edges around without fixing the source of the issue. An actual improvement would be to lookup the org settings as a data source but the API doesn't exist.

@lee2sh
Copy link
Copy Markdown
Author

lee2sh commented Jan 19, 2026

gotcha makes sense. will close the PR.

@lee2sh lee2sh closed this Jan 19, 2026
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.

[BUG]: allow_forking option breaks repo creation when the org doesn't allow forking

3 participants