-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
73 lines (61 loc) · 1.83 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
resource "github_repository" "main" {
name = var.name
description = var.description
homepage_url = var.homepage_url
visibility = "public"
topics = var.topics
// PR merging
allow_merge_commit = false
allow_rebase_merge = false
squash_merge_commit_title = "PR_TITLE"
squash_merge_commit_message = "PR_BODY"
allow_auto_merge = false
delete_branch_on_merge = true
has_issues = var.support_issues
has_discussions = var.support_discussions
has_downloads = false
auto_init = true
vulnerability_alerts = true
dynamic "pages" {
for_each = var.pages_enabled ? [1] : []
content {
build_type = "workflow"
}
}
lifecycle {
// Prevent imported repos from being recreated
ignore_changes = [auto_init]
}
}
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
contexts = concat(
var.support_releases ? ["pr-ci / semantic-pr-title", "release / release"] : [],
var.ci_contexts,
["license/cla"]
)
}
required_pull_request_reviews {
dismiss_stale_reviews = true
required_approving_review_count = 1
}
restrict_pushes {
blocks_creations = true
push_allowances = [
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" {
// https://kodiakhq.com/
repository = github_repository.main.name
name = "automerge"
description = "Allow kodiak to automerge commit when all checks pass"
color = "00A868"
}