From cfb828880722cb44086d52592ab3a9fd6fb35288 Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Mon, 30 Oct 2023 08:30:29 -0400 Subject: [PATCH 1/4] filter down webook events to reduce spam --- terraform/github/.terraform.lock.hcl | 63 +++++++++++++++------------- terraform/github/versions.tf | 4 +- terraform/github/webhooks.tf | 8 +++- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/terraform/github/.terraform.lock.hcl b/terraform/github/.terraform.lock.hcl index cd226f11f..8de57f52e 100644 --- a/terraform/github/.terraform.lock.hcl +++ b/terraform/github/.terraform.lock.hcl @@ -2,41 +2,44 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/carlpett/sops" { - version = "0.7.2" - constraints = "0.7.2" + version = "1.0.0" + constraints = "1.0.0" hashes = [ - "h1:+A1/RJ3eNVQHDFHjol70EfC5Yh9e78WMXxh1uoxlAYQ=", - "h1:3Bw0Dms7NNi0bgH9kdWcSapc9hBKQy9yFMwdxivR83c=", - "h1:eetjYKFBQb6nbgxjehD/gzzAmH2ru94ha2tEzXNiNy8=", - "h1:nWrLW+9JjGLwfss4T7pTaE+JiZlBJQGoYxt4pDe5OE8=", - "zh:43f218054ea3a72c9756bf989aeebb9d0f23b66fd08e9fb4ae75d4f921295e82", - "zh:57fd326388042a6b7ecd60f740f81e5ef931546c4f068f054e7df34acf65d190", - "zh:87b970db8c137f4c2fcbff7a5705419a0aea9268ae0ac94f1ec5b978e42ab0d2", - "zh:9e3b67b89ac919f01731eb0466baa08ce0721e6cf962fe6752e7cc526ac0cba0", - "zh:c028f67ef330be0d15ce4d7ac7649a2e07a98ed3003fca52e0c72338b5f481f8", - "zh:c29362e36a44480d0d9cb7d90d1efba63fe7e0e94706b2a07884bc067c46cbc7", - "zh:d5bcfa836244718a1d564aa96eb7d733b4d361b6ecb961f7c5bcd0cadb1dfd05", + "h1:Ef2u9JLvoQv2TNT6rpuaKQu7Ps5teZKfGSxpoBMMEOk=", + "h1:TH4f9LP2BmNitUL0c7I5aRMc8J31aetxTNDnFPYTllc=", + "h1:eZHDYGcrxRCePZ+YnQD5774/LD7aROyiJb56ypsQFfA=", + "h1:tnN2Mgl0NUF3cg7a0HtGmtOhHcG+tkaT6ncOPRuA9l8=", + "zh:064e63ea800cd1a8e575064097bc7de6fd5faa8ad50dbb3f2f9d8a3ebc9d7b97", + "zh:0663900085949d2faf24c170c7cdfbf76e545797915cc331da8304144c02bf27", + "zh:2ff26c7e5ee356c30791a12dd8e114c6237bd873d09e52805cb30dd5d758ed23", + "zh:44211fa474112ad0c9fcdae03f13ec7c75cdefd3ab29979b99cb834208055593", + "zh:6c3ab441c12b9679ad1dcac580d1ee7782f0d94efe6da6e983435ed39335cd3f", + "zh:8924cc939b52382ef042dc38bde93cdf438ff0aeab5e1801fbd198f05b80cd47", + "zh:ebc189ce22c23b903399f71e33d465001a79d7de7f7bf115c7763fcf794f4b58", ] } provider "registry.terraform.io/integrations/github" { - version = "5.28.1" - constraints = "5.28.1" + version = "5.41.0" + constraints = "5.41.0" hashes = [ - "h1:fSlsdrE/9U7mo6Dk8wrOcvVTg0T/zWMGxpB51HXd/L4=", - "zh:37f5687e3bc82463b703387eaf292c290ba30bc30c8461606d32693b2c11243c", - "zh:438a2aa714a0f5115a8a056708bd9d3c579b4107ce424ee11be70ee376c93d42", - "zh:6e5590d4656a85175d2038dfddad718d6feb60e009f8f27971a42542300ce8f9", - "zh:74a256795c411f5b04189e65e0809ddefd8da3ba976a6c673233af632dde629f", - "zh:75ad6f9f611f4f815ab1453a94fa06992947d2483c3ade15e203591d4ec29f59", - "zh:88283524729d8487fbd19195b7d2a3b5cfb58ed6262926cd198058bf87772a83", - "zh:907d2238c609c91ad7f2d6d90fa3f8cf9b007f647f46091304e625c89901e704", - "zh:92e2c38628e22e88baa2ad8676afe842f7634f0a677666ab6616bb7a76b35047", - "zh:b21cc68dec9588714d8239066e64778a5d10e7b966b78c4897eeb7e3760b9635", - "zh:bd968336ee97a8e9f852ca95915a4f49dc9401ecce9f1fe03aa14344f3a93388", - "zh:cb83519a82fa44e88f6cd1788b9da4da8f4f85ab4d502566b291bcb0ec5c6814", - "zh:d9bdf0f2e1763f82a71247a83c31349a515300786814e0f3b9938ef359953cd2", - "zh:f28751a4dfe82128ce80075dd4f2edcf3928c2eddaa9cf3beca2a71ce300b01b", - "zh:fb3bb78e898baaf40c2e58f2e0645ba59a333ea0a9cd5cee110424c5791e7a0c", + "h1:/L5tlvUrlRUsfLjF3M7ygTCL+AfVgB2CbSk8p8vW5dE=", + "h1:2CR1kaelJPU2E8jH6FtL4q4LW5qdk/gKpeEVEqe5is8=", + "h1:HYNijFnRwDHU5h/IJv+/j8oV3JRyqEOVRJxo8X+1v2c=", + "h1:kcUwo3XrhkcDQwgynF/p57Hpp0GUcqf7KTzUNbSrN6k=", + "zh:05ccd9a029cf34ebb2854a2aedc1b0ae969c9ba412a3be67d54f24bead85ec67", + "zh:100de3d1ff152a54801e168ae6ba11d3d7b284f2ca88179227a8ee0ee048200a", + "zh:236125b40405005614c0940f9b1bf861034ca09859cbe0a9b23325a12bdd3541", + "zh:4270cac2acc5996fc06ea1d429eafd80564529600846b3c35f7bcb937fea5a79", + "zh:47b4370b1d0d3268db9675f9a0a4ca55d881b0b7152db7a3d7ac0507a5881c7e", + "zh:59bd884c2ccc2bcfcf77d8861486cb91e0a82778a9434117fc482353f185c4d5", + "zh:638e1dc47f22d75bb14c00512a99128ef4a96ba48c29d511817ec49195adbdf5", + "zh:6d3dca7b298fa75cf776e1f1a03438e83105f3c25ce1814376ff8e59e8edc63f", + "zh:6e991e82a9ebc5141a5c9925fb4ee79f0b09d83a2b60912e864a77aa92282d5a", + "zh:7aae66b8242f0a32ecf0ba748e520045f07fa9f3b5ef86a9d55a0dbe48b0966b", + "zh:82dca6c117f4445476e67acdded8e8d956b261518b53d60431e5e2d4e4ed6a19", + "zh:8ee4dd233acb0cdcb7373b4c71c4d71c6bc09de054adb30e3affb49af9340d56", + "zh:e8b70c87f19970541837e8c19275b35b12b744e6da2d9ba18757ccabd7738945", + "zh:f2a4712f059a1dceb94d1f5c70b3781cfef413c1240f18450c23ec7114f80db2", ] } diff --git a/terraform/github/versions.tf b/terraform/github/versions.tf index c3913d667..34c3747b9 100644 --- a/terraform/github/versions.tf +++ b/terraform/github/versions.tf @@ -3,11 +3,11 @@ terraform { required_providers { github = { source = "integrations/github" - version = "5.28.1" + version = "5.41.0" } sops = { source = "carlpett/sops" - version = "0.7.2" + version = "1.0.0" } } } diff --git a/terraform/github/webhooks.tf b/terraform/github/webhooks.tf index 5e7479914..308108976 100644 --- a/terraform/github/webhooks.tf +++ b/terraform/github/webhooks.tf @@ -11,7 +11,13 @@ resource "github_repository_webhook" "discord" { repository = each.key active = true - events = ["*"] + events = [ + "fork", + "issues", + "release", + "star", + "watch" + ] configuration { url = data.sops_file.secrets.data["discord_webhook_url"] From d3568ac78591276de74e0e5e9e06a0c0fec18c17 Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Mon, 30 Oct 2023 08:48:01 -0400 Subject: [PATCH 2/4] remove deprecated repos --- terraform/github/terraform.tfvars | 42 ++----------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/terraform/github/terraform.tfvars b/terraform/github/terraform.tfvars index 07959f2e3..00b23b742 100755 --- a/terraform/github/terraform.tfvars +++ b/terraform/github/terraform.tfvars @@ -63,18 +63,6 @@ repositories = { description = "A repository of examples showing how to use Effect" enable_pages = false } - # express = { - # description = "Express integration with Effect" - # } - fastify = { - description = "Fastify integration with Effect" - collaborators = [ - { username = "antoine-coulon", permission = "push" }, - { username = "jbmusso", permission = "push" }, - { username = "tarrsalah", permission = "push" } - ] - enable_pages = false - } # figlet = { # description = "An implementation of a FIGlet font parser and renderer built with Effect" # } @@ -109,19 +97,10 @@ repositories = { homepage_url = "https://effect-ts.github.io/misc" enable_pages = false } - node = { - description = "" - homepage_url = "https://effect-ts.github.io/node" - topics = ["functional", "node"] - enable_pages = false - } opentelemetry = { description = "OpenTelemetry integration with Effect" homepage_url = "https://effect-ts.github.io/opentelemetry" } - # otel = { - # description = "" - # } platform = { description = "Unified interfaces for common platform-specific services" homepage_url = "https://effect-ts.github.io/platform" @@ -133,17 +112,9 @@ repositories = { # process = { # description = "A simple library for interacting with external processes and command-line programs via Effect" # } - query = { - description = "Efficiently pipeline, batch, and cache requests to any data source" - homepage_url = "https://effect-ts.github.io/query" - topics = ["batching", "caching", "functional", "pipelining", "query"] - } - remix-plugin = { - description = "" - enable_pages = false - } rpc = { - description = "" + description = "" + homepage_url = "https://effect-ts.github.io/rpc" } scala-playground = { description = "A Scala playground for the Effect maintainers" @@ -153,11 +124,6 @@ repositories = { description = "Modeling the schema of data structures as first-class values" homepage_url = "https://effect-ts.github.io/schema" } - sqlite = { - description = "" - collaborators = [{ username = "lokhmakov", permission = "maintain" }] - enable_pages = false - } stm = { description = "An implementation of software transactional memory built with Effect" homepage_url = "https://effect-ts.github.io/stm" @@ -174,10 +140,6 @@ repositories = { description = "A collection of re-usable typeclasses for the Effect ecosystem" homepage_url = "https://effect-ts.github.io/typeclass" } - vite-plugin = { - description = "" - enable_pages = false - } website = { description = "Source code for Effect's documentation website" collaborators = [{ username = "wpoosanguansit", permission = "push" }] From ac11232922e2a435f46aceb3f1cc7689d9917cd1 Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Sat, 4 Nov 2023 15:00:54 -0400 Subject: [PATCH 3/4] fixup the github terraform infrastructure --- shell.nix | 1 - terraform/github/repositories.tf | 82 ------------ terraform/github/repository.tf | 13 ++ terraform/github/terraform.tfvars | 82 +++++++----- terraform/github/variables.tf | 15 ++- terraform/github/versions.tf | 4 +- terraform/github/webhooks.tf | 6 +- terraform/modules/github_repository/branch.tf | 29 +++++ .../github_repository/collaborators.tf | 12 ++ .../modules/github_repository/repository.tf | 34 +++++ .../modules/github_repository/variables.tf | 118 ++++++++++++++++++ .../modules/github_repository/versions.tf | 9 ++ 12 files changed, 279 insertions(+), 126 deletions(-) delete mode 100644 terraform/github/repositories.tf create mode 100644 terraform/github/repository.tf create mode 100644 terraform/modules/github_repository/branch.tf create mode 100644 terraform/modules/github_repository/collaborators.tf create mode 100644 terraform/modules/github_repository/repository.tf create mode 100644 terraform/modules/github_repository/variables.tf create mode 100644 terraform/modules/github_repository/versions.tf diff --git a/shell.nix b/shell.nix index 3eba3c5e6..b412c3dad 100644 --- a/shell.nix +++ b/shell.nix @@ -33,7 +33,6 @@ in python310Packages.pre-commit-hooks sops ssh-to-age - terraform ]; KUSTOMIZE_PLUGIN_HOME = pkgs.buildEnv { diff --git a/terraform/github/repositories.tf b/terraform/github/repositories.tf deleted file mode 100644 index 34ef35190..000000000 --- a/terraform/github/repositories.tf +++ /dev/null @@ -1,82 +0,0 @@ -resource "github_repository" "repository" { - for_each = var.repositories - - name = each.key - allow_merge_commit = false - allow_rebase_merge = false - allow_squash_merge = true - delete_branch_on_merge = true - description = each.value.description - has_downloads = true - has_issues = true - has_projects = true - has_wiki = each.value.visibility == "public" - homepage_url = try(each.value.homepage_url, "") - squash_merge_commit_message = "BLANK" - squash_merge_commit_title = "PR_TITLE" - topics = each.value.topics - visibility = each.value.visibility - - dynamic "pages" { - for_each = each.value.enable_pages ? [1] : [] - - content { - source { - branch = var.default_branch - path = "/docs" - } - } - } -} - -resource "github_branch" "main" { - for_each = github_repository.repository - - branch = var.default_branch - repository = each.value.name -} - -resource "github_branch_default" "main" { - for_each = github_repository.repository - - branch = var.default_branch - repository = each.value.name -} - -resource "github_branch_protection" "main" { - for_each = { - for repository in github_repository.repository : - # Branch protection can only be enabled on private repositories with a paid - # GitHub plan - repository.name => repository.node_id if repository.visibility == "public" - } - - repository_id = each.value - pattern = var.default_branch - enforce_admins = true - required_linear_history = true - - required_status_checks { - strict = true - contexts = null - } - - required_pull_request_reviews { - required_approving_review_count = 0 - } -} - -resource "github_repository_collaborators" "collaborators" { - for_each = github_repository.repository - - repository = each.value.name - - dynamic "user" { - for_each = var.repositories[each.value.name].collaborators - - content { - username = user.value.username - permission = user.value.permission - } - } -} diff --git a/terraform/github/repository.tf b/terraform/github/repository.tf new file mode 100644 index 000000000..4d17f6767 --- /dev/null +++ b/terraform/github/repository.tf @@ -0,0 +1,13 @@ +module "github_repository" { + source = "../modules/github_repository" + for_each = var.repositories + name = each.key + description = each.value.description + topics = each.value.topics + homepage_url = each.value.homepage_url + visibility = each.value.visibility + collaborators = each.value.collaborators + has_discussions = each.value.has_discussions + has_pages = each.value.has_pages + is_archived = each.value.is_archived +} diff --git a/terraform/github/terraform.tfvars b/terraform/github/terraform.tfvars index 00b23b742..a6fd7e26b 100755 --- a/terraform/github/terraform.tfvars +++ b/terraform/github/terraform.tfvars @@ -3,6 +3,9 @@ changeset_bot_installation_id = "35785996" default_branch = "main" repositories = { + awesome-effect = { + has_pages = false + } babel-plugin = { description = "A babel plugin purpose-built for the Effect ecosystem" homepage_url = "https://effect-ts.github.io/babel-plugin" @@ -14,15 +17,24 @@ repositories = { cache = { description = "An Effect native cache with a simple and compositional interface" homepage_url = "https://effect-ts.github.io/cache" + is_archived = true } cli = { description = "Rapidly build powerful and composable command-line applications" homepage_url = "https://effect-ts.github.io/cli" } + cluster = { + has_pages = false + } data = { description = "Custom built data types leveraged by the Effect ecosystem" collaborators = [{ username = "enricopolanski", permission = "push" }] homepage_url = "https://effect-ts.github.io/data" + is_archived = true + } + discord-bot = { + description = "The Effect Community's custom Discord bot, built with Effect" + has_pages = false } docgen = { description = "An opinionated documentation generator for Effect projects" @@ -31,18 +43,18 @@ repositories = { docs-ai = { description = "Experimentation with artificial intelligence for augmenting Effect's documentation" enable_changesets = false - enable_pages = false + has_pages = false visibility = "private" } discord-bot = { description = "The Effect Community's custom Discord bot, built with Effect" collaborators = [{ username = "tim-smart", permission = "push" }] enable_changesets = false - enable_pages = false + has_pages = false } dtslint = { - description = "Effect's custom fork of dtslint used to lint TypeScript declaration (.d.ts) files" - enable_pages = false + description = "Effect's custom fork of dtslint used to lint TypeScript declaration (.d.ts) files" + has_pages = false } effect = { description = "A fully-fledged functional effect system for TypeScript with a rich standard library" @@ -56,46 +68,45 @@ repositories = { topics = ["effect-system", "fp", "framework", "stack-safe", "typescript", "zio"] } eslint-plugin = { - description = "A set of ESlint and TypeScript rules to work with Effect" - enable_pages = false + description = "A set of ESlint and TypeScript rules to work with Effect" + has_pages = false } examples = { - description = "A repository of examples showing how to use Effect" - enable_pages = false + description = "A repository of examples showing how to use Effect" + has_pages = false } - # figlet = { - # description = "An implementation of a FIGlet font parser and renderer built with Effect" - # } - html = { - description = "" - enable_pages = false + figlet = { + description = "An implementation of a FIGlet font parser and renderer built with Effect" + has_pages = false } + # Comment in once the repo has commits + # general-issues = { + # has_discussions = true + # has_pages = false + # } infra = { description = "Infrastructure relevant to the Effect organization" enable_changesets = false - enable_pages = false + has_pages = false } io = { description = "Effect's core runtime, a fiber-based implementation of structured concurrency" homepage_url = "https://effect-ts.github.io/io" + is_archived = true } - # jest = { - # description = "" - # } language-service = { - description = "" - enable_pages = false + has_pages = false } match = { description = "Functional pattern matching with the full power of TypeScript" collaborators = [{ username = "tim-smart", permission = "maintain" }] homepage_url = "https://effect-ts.github.io/match" topics = ["functional-programming", "pattern-matching", "typescript"] + is_archived = true } - misc = { - description = "" - homepage_url = "https://effect-ts.github.io/misc" - enable_pages = false + monorepo-testing = { + collaborators = [{ username = "fubhy", permission = "push" }] + has_pages = false } opentelemetry = { description = "OpenTelemetry integration with Effect" @@ -109,16 +120,13 @@ repositories = { description = "An easy to use, extensible pretty-printer for rendering documents" homepage_url = "https://effect-ts.github.io/printer" } - # process = { - # description = "A simple library for interacting with external processes and command-line programs via Effect" - # } rpc = { description = "" homepage_url = "https://effect-ts.github.io/rpc" } scala-playground = { - description = "A Scala playground for the Effect maintainers" - enable_pages = false + description = "A Scala playground for the Effect maintainers" + has_pages = false } schema = { description = "Modeling the schema of data structures as first-class values" @@ -127,25 +135,34 @@ repositories = { stm = { description = "An implementation of software transactional memory built with Effect" homepage_url = "https://effect-ts.github.io/stm" + is_archived = true } stream = { description = "An implementation of pull-based streams built with Effect" homepage_url = "https://effect-ts.github.io/stream" + is_archived = true + } + team = { + visibility = "private" + enable_changesets = false + has_pages = false } test = { - description = "" homepage_url = "https://effect-ts.github.io/test" } typeclass = { description = "A collection of re-usable typeclasses for the Effect ecosystem" homepage_url = "https://effect-ts.github.io/typeclass" } + vite-plugin-react = { + has_pages = false + } website = { description = "Source code for Effect's documentation website" - collaborators = [{ username = "wpoosanguansit", permission = "push" }] + collaborators = [{ username = "lukaswiesehan", permission = "push" }] homepage_url = "https://www.effect.website" enable_changesets = false - enable_pages = false + has_pages = false } } @@ -161,6 +178,7 @@ organization_owners = [ organization_members = [ "0x706b", "aniravi24", + "fubhy", "mattiamanzati", "patroza", "pigoz", diff --git a/terraform/github/variables.tf b/terraform/github/variables.tf index f84c6e5cd..455bc1542 100644 --- a/terraform/github/variables.tf +++ b/terraform/github/variables.tf @@ -11,13 +11,18 @@ variable "default_branch" { variable "repositories" { description = "The Effect-TS organization repositories whose configuration should be managed" type = map(object({ - description = optional(string, ""), - collaborators = optional(list(object({ username = string, permission = string })), []) - homepage_url = optional(string) - topics = optional(list(string), []), + description = optional(string, "") + topics = optional(set(string), []) + homepage_url = optional(string, "") visibility = optional(string, "public") - enable_pages = optional(bool, true), + is_archived = optional(bool, false) + has_discussions = optional(bool, false) + has_pages = optional(bool, true) enable_changesets = optional(bool, true) + collaborators = optional(list(object({ + username = string, + permission = string + })), []) })) } diff --git a/terraform/github/versions.tf b/terraform/github/versions.tf index 34c3747b9..ef3d364c0 100644 --- a/terraform/github/versions.tf +++ b/terraform/github/versions.tf @@ -1,9 +1,9 @@ terraform { - required_version = ">= 1.3" + required_version = ">= 1.5" required_providers { github = { source = "integrations/github" - version = "5.41.0" + version = "~> 5.0" } sops = { source = "carlpett/sops" diff --git a/terraform/github/webhooks.tf b/terraform/github/webhooks.tf index 308108976..f663ced80 100644 --- a/terraform/github/webhooks.tf +++ b/terraform/github/webhooks.tf @@ -12,11 +12,9 @@ resource "github_repository_webhook" "discord" { active = true events = [ - "fork", "issues", - "release", - "star", - "watch" + "pull_request", + "release" ] configuration { diff --git a/terraform/modules/github_repository/branch.tf b/terraform/modules/github_repository/branch.tf new file mode 100644 index 000000000..f1f886cd0 --- /dev/null +++ b/terraform/modules/github_repository/branch.tf @@ -0,0 +1,29 @@ +resource "github_branch" "main" { + branch = var.default_branch + repository = github_repository.repository.name +} + +resource "github_branch_default" "main" { + branch = var.default_branch + repository = github_repository.repository.name +} + +resource "github_branch_protection" "main" { + # Branch protection can only be enabled on private repositories if using a + # paid GitHub plan + count = var.visibility == "public" ? 1 : 0 + + repository_id = github_repository.repository.node_id + pattern = var.default_branch + enforce_admins = true + required_linear_history = true + + required_status_checks { + strict = true + contexts = null + } + + required_pull_request_reviews { + required_approving_review_count = 0 + } +} diff --git a/terraform/modules/github_repository/collaborators.tf b/terraform/modules/github_repository/collaborators.tf new file mode 100644 index 000000000..149397086 --- /dev/null +++ b/terraform/modules/github_repository/collaborators.tf @@ -0,0 +1,12 @@ +resource "github_repository_collaborators" "collaborators" { + repository = github_repository.repository.name + + dynamic "user" { + for_each = var.collaborators + + content { + username = user.value.username + permission = user.value.permission + } + } +} diff --git a/terraform/modules/github_repository/repository.tf b/terraform/modules/github_repository/repository.tf new file mode 100644 index 000000000..db5e52b3e --- /dev/null +++ b/terraform/modules/github_repository/repository.tf @@ -0,0 +1,34 @@ +resource "github_repository" "repository" { + name = var.name + description = var.description + topics = var.topics + homepage_url = var.homepage_url + visibility = var.visibility + + allow_merge_commit = var.allow_merge_commit + allow_rebase_merge = var.allow_rebase_merge + allow_squash_merge = var.allow_squash_merge + delete_branch_on_merge = var.delete_branch_on_merge + squash_merge_commit_message = "BLANK" + squash_merge_commit_title = "PR_TITLE" + + archived = var.is_archived + has_discussions = var.has_discussions + has_downloads = var.has_downloads + has_issues = var.has_issues + has_projects = var.has_projects + has_wiki = var.visibility == "public" + + + dynamic "pages" { + for_each = var.has_pages ? [1] : [] + + content { + build_type = "legacy" + source { + branch = var.default_branch + path = "/docs" + } + } + } +} diff --git a/terraform/modules/github_repository/variables.tf b/terraform/modules/github_repository/variables.tf new file mode 100644 index 000000000..ec2de0829 --- /dev/null +++ b/terraform/modules/github_repository/variables.tf @@ -0,0 +1,118 @@ +################################################################################ +# Repository Variables +################################################################################ + +variable "name" { + type = string + description = "The name of the GitHub repository." +} + +variable "description" { + type = string + description = "A description of the repository." + default = "" +} + +variable "homepage_url" { + type = string + description = "The URL of a page describing the project." + default = "" +} + +variable "topics" { + type = set(string) + description = "The list of topics describing the repository." + default = [] +} + +variable "visibility" { + type = string + description = <<-EOF +Can be 'public' or 'private'. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be 'internal'. +EOF + validation { + condition = var.visibility == "public" || var.visibility == "private" + error_message = "The value of visibility must be one of 'public' or 'private'." + } +} + +variable "has_discussions" { + type = bool + description = "Set to 'true' to enable GitHub Discussions on the repository. Defaults to 'false'." + default = false +} + +variable "has_downloads" { + type = bool + description = "Set to 'true' to enable the (deprecated) downloads features on the repository." + default = true +} + +variable "has_issues" { + type = bool + description = "Set to 'true' to enable the GitHub Issues features on the repository." + default = true +} + +variable "has_pages" { + type = bool + description = "Whether or not to enable GitHub pages for the repository." + default = false +} + +variable "has_projects" { + type = bool + description = <<-EOF +Set to 'true' to enable the GitHub Projects features on the repository. Per the GitHub documentation when in an organization that has disabled repository projects it will default to 'false' and will otherwise default to 'true'. If you specify 'true' when it has been disabled it will return an error. +EOF + default = true +} + +variable "is_archived" { + type = bool + description = "Whether or not the repository should be archived." + default = false +} + +variable "collaborators" { + type = list(object({ + username = string, + permission = string + })) + description = "The GitHub users who are authorized to collaborate on the repository." + default = [] +} + +################################################################################ +# Repository Branch Variables +################################################################################ + +variable "default_branch" { + type = string + description = "The name of the default branch to create for the repository." + default = "main" +} + +variable "allow_merge_commit" { + type = bool + description = "Set to 'false' to disable merge commits to be created within the repository." + default = false +} + +variable "allow_rebase_merge" { + type = bool + description = "Set to 'false' to disable rebase merges to be created within the repository." + default = false +} + +variable "allow_squash_merge" { + type = bool + description = "Set to 'false' to disable squash merges to be created within the repository." + default = true +} + +variable "delete_branch_on_merge" { + type = bool + description = "Automatically delete head branch after a pull request is merged. Defaults to 'true'." + default = true +} diff --git a/terraform/modules/github_repository/versions.tf b/terraform/modules/github_repository/versions.tf new file mode 100644 index 000000000..3242cbd29 --- /dev/null +++ b/terraform/modules/github_repository/versions.tf @@ -0,0 +1,9 @@ +terraform { + required_version = ">= 1.5" + required_providers { + github = { + source = "integrations/github" + version = "~> 5.0" + } + } +} From 328934badc43f54c1945745ecc017ccac84cd4b0 Mon Sep 17 00:00:00 2001 From: Maxwell Brown Date: Sat, 4 Nov 2023 15:02:48 -0400 Subject: [PATCH 4/4] fix terraform version in ci template --- .github/workflows/terraform.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index 370f775aa..9632db506 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -49,7 +49,7 @@ jobs: - name: Setup Terraform uses: hashicorp/setup-terraform@v2 with: - terraform_version: 1.4.2 + terraform_version: 1.5.0 - name: Terraform Init id: init