Skip to content

github_branch_default: 422 Unprocessable Entity #625

@dee-kryvenko

Description

@dee-kryvenko

Terraform Version

{
  "terraform_version": "0.14.0",
  "terraform_revision": "",
  "provider_selections": {
    "registry.terraform.io/hashicorp/github": "4.1.0"
  },
  "terraform_outdated": false
}

Affected Resource(s)

  • github_branch_default

Terraform Configuration Files

resource "github_branch_default" "this" {
  repository = github_repository.this.name
  branch     = github_branch.this.branch
}

Debug Output

https://gist.github.com/dee-kryvenko/7cc5b517ef72ce4f87ee63aec5d178b0

Expected Behavior

Should have set default branch successfully.

Actual Behavior

Fails to do so.

Steps to Reproduce

  1. terraform apply

Important Factoids

I managed to narrow it down via curl to the following header: Accept: application/vnd.github.baptiste-preview+json, application/vnd.github.nebula-preview+json. It seems like if I remove application/vnd.github.nebula-preview+json part from my headers - it works. As it is used for the visibility field as described here https://docs.github.com/en/free-pro-team@latest/rest/reference/repos, I have tried to experiment with this field and it seems to only work if I set visibility: public. It fails as described above for both private and internal - so, unable to reproduce on a free org. It might be an issue with GitHub - I am currently talking to the Enterprise support and will update here with their findings.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions