Skip to content

Commit

Permalink
fix: Require linear history and resolved conversations before merging…
Browse files Browse the repository at this point in the history
… PRs (#4)

Fixes #1
  • Loading branch information
gnarea authored Dec 14, 2021
1 parent b399c3c commit 9d3bd5d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 27 deletions.
32 changes: 16 additions & 16 deletions examples/self/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/self/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 4.18.2"
version = "~> 4.19.0"
}
}
}
Expand All @@ -18,4 +18,5 @@ module "self" {
description = "Terraform module for open source projects by Relaycorp"
homepage_url = "https://registry.terraform.io/modules/relaycorp/oss-project/github/latest"
licence = "mit"
ci_contexts = ["ci"]
}
5 changes: 5 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
locals {
// Work around https://github.com/integrations/terraform-provider-github/issues/1009
github_actions_app_node_id = "MDM6QXBwMTUzNjg=" // https://api.github.com/apps/github-actions
kodiakhq_app_node_id = "MDM6QXBwMjkxOTY=" // https://api.github.com/apps/kodiakhq
}
19 changes: 10 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ resource "github_repository" "main" {
}
}

resource "github_branch_protection_v3" "main" {
repository = github_repository.main.name
branch = var.main_branch
resource "github_branch_protection" "main" {
repository_id = github_repository.main.node_id
pattern = "^${var.main_branch}$"

required_linear_history = true
require_conversation_resolution = true

required_status_checks {
strict = true
Expand All @@ -52,12 +55,10 @@ resource "github_branch_protection_v3" "main" {
required_approving_review_count = 1
}

restrictions {
apps = [
"github-actions", # Allow @semantic-release/github to create GH releases
"kodiakhq", # Allow Kodiak to merge PRs
]
}
push_restrictions = [
local.github_actions_app_node_id, # Allow @semantic-release/github to create GH releases
local.kodiakhq_app_node_id, # Allow Kodiak to merge PRs
]
}

resource "github_issue_label" "kodiak_automerge" {
Expand Down
2 changes: 1 addition & 1 deletion providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
github = {
source = "integrations/github"
version = "~> 4.18.2"
version = "~> 4.19.0"
}
}

Expand Down

0 comments on commit 9d3bd5d

Please sign in to comment.