Skip to content

Commit 2c74241

Browse files
authored
chore(repo-files): inherit CoC, Security, and Funding from .github repo (#1642)
Signed-off-by: Devin Buhl <devin@buhl.casa>
1 parent b98487a commit 2c74241

5 files changed

Lines changed: 28 additions & 1 deletion

File tree

tf/deployment/modules/shared/github/org/repo-files/CODE_OF_CONDUCT.md renamed to tf/deployment/modules/shared/github/org/org-meta-files/CODE_OF_CONDUCT.md

File renamed without changes.

tf/deployment/modules/shared/github/org/repo-files/.github/FUNDING.yml renamed to tf/deployment/modules/shared/github/org/org-meta-files/FUNDING.yml

File renamed without changes.

tf/deployment/modules/shared/github/org/repo-files/SECURITY.md renamed to tf/deployment/modules/shared/github/org/org-meta-files/SECURITY.md

File renamed without changes.

tf/deployment/modules/shared/github/org/repositories.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,33 @@ resource "github_repository_file" "default_files" {
299299
}
300300
}
301301

302+
# Community health files (CODE_OF_CONDUCT, SECURITY, FUNDING) only need to live in the
303+
# org's `.github` repository — GitHub will serve them as defaults to any child repo that
304+
# does not provide its own copy. See
305+
# https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file
306+
resource "github_repository_file" "org_meta_files" {
307+
for_each = toset([
308+
for file in fileset("${path.module}/org-meta-files", "**") : file
309+
if !can(regex(".*terragrunt.*", file))
310+
])
311+
repository = github_repository.repositories[".github"].name
312+
file = each.value
313+
content = file("${path.module}/org-meta-files/${each.value}")
314+
commit_message = "chore: inherit ${each.value} from org-level .github repo"
315+
overwrite_on_create = true
316+
317+
depends_on = [github_repository.repositories]
318+
319+
lifecycle {
320+
ignore_changes = [
321+
commit_message,
322+
commit_email,
323+
commit_author,
324+
overwrite_on_create
325+
]
326+
}
327+
}
328+
302329
resource "github_repository_file" "init_files" {
303330
for_each = {
304331
for combination in flatten([

tf/deployment/modules/shared/github/org/terragrunt.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ terraform {
55
commands = get_terraform_commands_that_need_vars()
66
}
77

8-
include_in_copy = ["repo-files/*", "license-files/*"]
8+
include_in_copy = ["repo-files/*", "license-files/*", "org-meta-files/*"]
99
}
1010

1111
inputs = {

0 commit comments

Comments
 (0)