Skip to content

Commit bed747c

Browse files
committed
Add Setting require_conversation_resolution for Branch Protection
1 parent 059d845 commit bed747c

File tree

5 files changed

+40
-16
lines changed

5 files changed

+40
-16
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,12 @@ This is due to some terraform limitation and we will update the module once terr
503503

504504
Default is `false`.
505505

506+
- [**`require_conversation_resolution`**](#attr-branch_protections_v3-require_conversation_resolution): *(Optional `bool`)*<a name="attr-branch_protections_v3-require_conversation_resolution"></a>
507+
508+
Setting this to true requires all conversations to be resolved.
509+
510+
Default is `false`.
511+
506512
- [**`require_signed_commits`**](#attr-branch_protections_v3-require_signed_commits): *(Optional `bool`)*<a name="attr-branch_protections_v3-require_signed_commits"></a>
507513

508514
Setting this to true requires all commits to be signed with GPG.
@@ -611,6 +617,12 @@ This is due to some terraform limitation and we will update the module once terr
611617

612618
Default is `false`.
613619

620+
- [**`require_conversation_resolution`**](#attr-branch_protections-require_conversation_resolution): *(Optional `bool`)*<a name="attr-branch_protections-require_conversation_resolution"></a>
621+
622+
Setting this to true requires all conversations to be resolved.
623+
624+
Default is `false`.
625+
614626
- [**`require_signed_commits`**](#attr-branch_protections-require_signed_commits): *(Optional `bool`)*<a name="attr-branch_protections-require_signed_commits"></a>
615627

616628
Setting this to true requires all commits to be signed with GPG.

README.tfdoc.hcl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,14 @@ section {
646646
END
647647
}
648648

649+
attribute "require_conversation_resolution" {
650+
type = bool
651+
default = false
652+
description = <<-END
653+
Setting this to true requires all conversations to be resolved.
654+
END
655+
}
656+
649657
attribute "require_signed_commits" {
650658
type = bool
651659
default = false

examples/public-repository/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ module "repository" {
4949

5050
branch_protections = [
5151
{
52-
branch = "main"
53-
enforce_admins = true
54-
require_signed_commits = true
52+
branch = "main"
53+
enforce_admins = true
54+
require_conversation_resolution = true
55+
require_signed_commits = true
5556

5657
required_status_checks = {
5758
strict = true

main.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ locals {
4343
locals {
4444
branch_protections = try([
4545
for b in local.branch_protections_v3 : merge({
46-
branch = null
47-
enforce_admins = null
48-
require_signed_commits = null
49-
required_status_checks = {}
50-
required_pull_request_reviews = {}
51-
restrictions = {}
46+
branch = null
47+
enforce_admins = null
48+
require_conversation_resolution = null
49+
require_signed_commits = null
50+
required_status_checks = {}
51+
required_pull_request_reviews = {}
52+
restrictions = {}
5253
}, b)
5354
], [])
5455

@@ -171,10 +172,11 @@ resource "github_branch_protection_v3" "branch_protection" {
171172
github_team_repository.team_repository_by_slug
172173
]
173174

174-
repository = github_repository.repository.name
175-
branch = local.branch_protections[count.index].branch
176-
enforce_admins = local.branch_protections[count.index].enforce_admins
177-
require_signed_commits = local.branch_protections[count.index].require_signed_commits
175+
repository = github_repository.repository.name
176+
branch = local.branch_protections[count.index].branch
177+
enforce_admins = local.branch_protections[count.index].enforce_admins
178+
require_conversation_resolution = local.branch_protections[count.index].require_conversation_resolution
179+
require_signed_commits = local.branch_protections[count.index].require_signed_commits
178180

179181
dynamic "required_status_checks" {
180182
for_each = local.required_status_checks[count.index]

test/unit-complete/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ module "repository" {
7676

7777
branch_protections = [
7878
{
79-
branch = "main"
80-
enforce_admins = true
81-
require_signed_commits = true
79+
branch = "main"
80+
enforce_admins = true
81+
require_conversation_resolution = true
82+
require_signed_commits = true
8283

8384
required_status_checks = {
8485
strict = true

0 commit comments

Comments
 (0)