-
Notifications
You must be signed in to change notification settings - Fork 763
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
github_branch_protection does not enable "Require status checks to pass before merging" #880
Comments
Can confirm, I am experiencing the same issue with the |
I am facing this problem as well on 4.14 and realized that it works if I go back to |
I've confirmed this behavior. Using the above HCL produces a weird state in the GitHub UI where status checks aren't required before merging: But upon clicking that checkbox, the "up to date" checkbox appears, already checked: which is not the usual behavior of the checkbox when purely operating through the GitHub API. Upon further debugging, the issue happens because This definitely requires more investigation. |
Okay! I'm back with another update on this issue. It turns out that the reason that check isn't enabled is because of the I'm playing around with some solutions in #954 to see if I can fix this without causing a regression of #572. Incidentally, I found it helpful to set up a debugger to figure out what was going on here, so I've opened #955 to document that in hopes it'll be useful for others in the future. |
Upon further thought, I might it might be best to remove the diff suppression function wholesale (with other minor code changes). The current behavior is incorrect, and I am unable to produce the bug in #572, which appears to be a constant spurious diff. When strict status checks are set to true, the second Subsequent applies look like this: When creating branch protection rules with strict status checks, the second And subsequent ones look like this: All applies appear correct in fuctionality, in contract to the first system. I've updated #954 to remove the diff suppresion func entirely, and I'll post these findings and mention the original authors there to see if they have comments. |
I've done more extensive testing (documented here) and the fix is ready for review! |
👋 Hey Friends, this issue has been automatically marked as |
Closing this issue as #954 has been merged already. |
Terraform Version
Affected Resource(s)
github_branch_protection
Terraform Configuration Files
Expected Behavior
"Require status checks to pass before merging" and "Require branches to be up to date before merging" options in branch protection should be enabled.
Actual Behavior
"Require status checks to pass before merging" is disabled and "Require branches to be up to date before merging" is enabled.
Steps to Reproduce
terraform apply
Important Factoids
We upgraded from github provider
3.0.0
to4.13.0
a while ago and recently noticed that this configuration behaves differently.In 3.0.0 setting
strict = true
inrequired_status_checks
would enable both "Require status checks to pass before merging" and "Require branches to be up to date before merging".In 4.13.0 it only enables "Require branches to be up to date before merging", which is weird because that option in the UI is hidden behind "Require status checks to pass before merging".
Note that the intention here is to require all status checks to pass before merging. Passing an empty
contexts = []
in therequired_status_checks
block does not seem to help and we're applying these branch protection rules on multiple repositories where we don't know the context names.The text was updated successfully, but these errors were encountered: