Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Setting a default branch name other than 'main' causes 422 Errors #125

Open
bzarboni1 opened this issue Dec 12, 2024 · 0 comments
Open

Comments

@bzarboni1
Copy link
Contributor

bzarboni1 commented Dec 12, 2024

ISSUE

When creating new repositories, with branch names [production, non-production, development], and setting the default_branch = "production", there are 422 errors.

Terraform:

private_repositories = {
    myorg-gcp-00-bootstrap = {
      advance_security            = false
      allow_auto_merge            = true
      default_branch              = "production"
      delete_head_on_merge        = true
      dependabot_security_updates = false
      description                 = "Used to hold the bootstrap terraform for the GCP Organization"
      has_vulnerability_alerts    = true
      homepage                    = ""
      protected_branches          = ["production", "development", "non-production"]
      requires_web_commit_signing = true
      topics                      = ["gcp", "infrastructure-as-code"]
    }

Error:

│ Error: PATCH https://api.github.com/repos/FociSolutions/bupa-gcp-02-environments: 422 Validation Failed [{Resource:Repository Field:default_branch Code:invalid Message:The branch production was not found. Please push that ref first or create it via the Git Data API.}]
│ 
│   with module.private_repositories["bupa-gcp-02-environments"].module.repository_base.github_branch_default.default_branch,
│   on ../repository_base/repository.tf line 98, in resource "github_branch_default" "default_branch":
│   98: resource "github_branch_default" "default_branch" {
│ 
@bzarboni1 bzarboni1 changed the title [Bug] Setting a default branch name other than 'main [Bug] Setting a default branch name other than 'main' causes 422 Errors Dec 12, 2024
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

No branches or pull requests

1 participant