terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

feat: automatic branch creation for resource 'github_repository_file'

Open wparr-circle opened this issue 1 year ago • 2 comments

Resolves #2101


Before the change?

  • Currently repository_file does not support automatic creation of branches. This means in order manage files via pull requests (rather than directly pushing to the branch ie. main), a branch would need created. This has impacts on terraform lifecycle post-creation ie. a pull request merging the branch and deleting it, in which the branch would attempt to be re-created causing a long-lived branch to exist in a repo.

After the change?

  • When the flag autocreate_branch is set true, if the branch does not already exist then it shall be created based on autocreate_branch_source_sha or autocreate_branch_source_branch which defaults to main during create, update or destroy. Given the branch could be ephemeral; on reads, if the branch does not exist then content shall be read from autocreate_branch_source_branch as it may been merged.

Pull request checklist

  • [x] Tests for the changes have been added (for bug fixes / features)
  • [x] 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
  • [x] No

wparr-circle avatar Jan 15 '24 12:01 wparr-circle

@wparr-circle there's a pretty quick go fmt issue to resolve here, then I can get this merged and released.

kfcampbell avatar Feb 05 '24 21:02 kfcampbell

@kfcampbell applied go fmt changes now. Thanks

wparr-circle avatar Feb 08 '24 11:02 wparr-circle