-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
54 lines (45 loc) · 1.31 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
resource "github_repository" "main" {
name = var.name
description = var.description
homepage_url = var.homepage_url
visibility = "private"
// 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 = true
delete_branch_on_merge = true
has_issues = false
has_discussions = false
has_downloads = false
auto_init = true
vulnerability_alerts = true
lifecycle {
// Prevent imported repos from being recreated
ignore_changes = [auto_init]
}
}
resource "github_branch_protection" "main" {
repository_id = github_repository.main.node_id
pattern = "main"
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,
)
}
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
]
}
}