From 204a8c6e40a2ccdfb4cd85c8674021ae064041e7 Mon Sep 17 00:00:00 2001 From: foooomio Date: Wed, 16 Dec 2020 01:59:15 +0900 Subject: [PATCH 1/3] Support terraform-provider-github v4 --- terraform/github/branch_protection.tf | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/terraform/github/branch_protection.tf b/terraform/github/branch_protection.tf index 0d594bf..d565dd7 100644 --- a/terraform/github/branch_protection.tf +++ b/terraform/github/branch_protection.tf @@ -1,6 +1,6 @@ resource "github_branch_protection" "hackathon_master" { - repository = "hackathon" - branch = "master" + repository_id = github_repository.hackathon.node_id + pattern = "master" enforce_admins = false required_status_checks {} @@ -9,33 +9,31 @@ resource "github_branch_protection" "hackathon_master" { dismiss_stale_reviews = false } - restrictions { - teams = ["imas_hack"] - } + push_restrictions = [ + data.github_team.imas_hack.node_id + ] } resource "github_branch_protection" "mastodon_imastodon" { - repository = "mastodon" - branch = "imastodon" + repository_id = github_repository.mastodon.node_id + pattern = "imastodon" enforce_admins = false required_status_checks { strict = false contexts = [ - "ci/circleci: test-ruby2.6", + "ci/circleci: test-ruby2.6", ] } required_pull_request_reviews { dismiss_stale_reviews = false } - - restrictions {} } resource "github_branch_protection" "imasparql_master" { - repository = "imasparql" - branch = "master" + repository_id = github_repository.imasparql.node_id + pattern = "master" enforce_admins = false required_status_checks { @@ -48,6 +46,4 @@ resource "github_branch_protection" "imasparql_master" { require_code_owner_reviews = true required_approving_review_count = 1 } - - restrictions {} } From 113fba111f7f754c45484a2b44dac093bb18a6f7 Mon Sep 17 00:00:00 2001 From: foooomio Date: Wed, 16 Dec 2020 02:04:32 +0900 Subject: [PATCH 2/3] Fix --- terraform/github/branch_protection.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/terraform/github/branch_protection.tf b/terraform/github/branch_protection.tf index d565dd7..96f6453 100644 --- a/terraform/github/branch_protection.tf +++ b/terraform/github/branch_protection.tf @@ -1,5 +1,5 @@ resource "github_branch_protection" "hackathon_master" { - repository_id = github_repository.hackathon.node_id + repository_id = "hackathon" pattern = "master" enforce_admins = false @@ -15,7 +15,7 @@ resource "github_branch_protection" "hackathon_master" { } resource "github_branch_protection" "mastodon_imastodon" { - repository_id = github_repository.mastodon.node_id + repository_id = "mastodon" pattern = "imastodon" enforce_admins = false @@ -32,7 +32,7 @@ resource "github_branch_protection" "mastodon_imastodon" { } resource "github_branch_protection" "imasparql_master" { - repository_id = github_repository.imasparql.node_id + repository_id = "imasparql" pattern = "master" enforce_admins = false From 92b4fb69fa56621b146b43c0a777b08bca4515a4 Mon Sep 17 00:00:00 2001 From: foooomio Date: Wed, 16 Dec 2020 02:07:19 +0900 Subject: [PATCH 3/3] Fix --- terraform/github/branch_protection.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/github/branch_protection.tf b/terraform/github/branch_protection.tf index 96f6453..0cd5a2d 100644 --- a/terraform/github/branch_protection.tf +++ b/terraform/github/branch_protection.tf @@ -10,7 +10,7 @@ resource "github_branch_protection" "hackathon_master" { } push_restrictions = [ - data.github_team.imas_hack.node_id + "imas_hack" ] }