|
| 1 | +module "repository" { |
| 2 | + source = "git::https://github.com/r-webdev/terraform-module-github-repository.git//modules/service?ref=v1.0.0" |
| 3 | + |
| 4 | + # Repository name on GitHub (must match the remote, e.g. r-webdev/website). |
| 5 | + name = "website" |
| 6 | + |
| 7 | + # Short summary shown on the repo homepage and in search results. |
| 8 | + description = "Community website for the Web Dev & Design Discord server." |
| 9 | + |
| 10 | + # Link shown in the GitHub sidebar; should match PUBLIC_SITE_URL in Cloudflare Pages. |
| 11 | + homepage_url = "https://webdevdesign.pages.dev" |
| 12 | + |
| 13 | + # Who can see the repo: public, private, or internal (org members only). |
| 14 | + # Public is required on GitHub Free for branch protection rules to apply. |
| 15 | + visibility = "public" |
| 16 | + |
| 17 | + # Tags used for discovery and filtering on GitHub. |
| 18 | + topics = ["website"] |
| 19 | + |
| 20 | + # Default branch for new PRs and clones; must already exist on GitHub before protection rules apply. |
| 21 | + default_branch = "main" |
| 22 | + |
| 23 | + # --- Merge settings --- |
| 24 | + |
| 25 | + # Disallow standard merge commits (only squash merges allowed). |
| 26 | + allow_merge_commit = false |
| 27 | + |
| 28 | + # Allow squash merges — combines all commits into one on merge. |
| 29 | + allow_squash_merge = true |
| 30 | + |
| 31 | + # Disallow rebase merges onto the base branch. |
| 32 | + allow_rebase_merge = false |
| 33 | + |
| 34 | + # Use the PR title as the squash commit subject line. |
| 35 | + squash_merge_commit_title = "PR_TITLE" |
| 36 | + |
| 37 | + # Include individual commit messages in the squash commit body. |
| 38 | + squash_merge_commit_message = "COMMIT_MESSAGES" |
| 39 | + |
| 40 | + # Remove the feature branch from GitHub after the PR is merged. |
| 41 | + delete_branch_on_merge = true |
| 42 | + |
| 43 | + # Do not allow merging automatically once checks and reviews pass (manual merge required). |
| 44 | + allow_auto_merge = false |
| 45 | + |
| 46 | + # --- Repository features --- |
| 47 | + |
| 48 | + # Enable GitHub Issues for bugs and feature requests. |
| 49 | + has_issues = true |
| 50 | + |
| 51 | + # Disable GitHub Projects (Kanban-style boards tied to the repo). |
| 52 | + has_projects = false |
| 53 | + |
| 54 | + # Disable the repo wiki. |
| 55 | + has_wiki = false |
| 56 | + |
| 57 | + # Disable GitHub Discussions. |
| 58 | + has_discussions = false |
| 59 | + |
| 60 | + # Send Dependabot security alerts for vulnerable dependencies (relevant for private repos). |
| 61 | + vulnerability_alerts = true |
| 62 | + |
| 63 | + # If Terraform destroys this resource, archive the repo instead of deleting it permanently. |
| 64 | + archive_on_destroy = true |
| 65 | + |
| 66 | + # --- Access control --- |
| 67 | + |
| 68 | + # Map of org team slug → permission level (pull, triage, push, maintain, admin). |
| 69 | + team_permissions = { |
| 70 | + # Full admin access: settings, branch protection, team management. |
| 71 | + admins = "admin" |
| 72 | + # Write access: push to branches and open/merge PRs (subject to branch protection). |
| 73 | + moderators = "push" |
| 74 | + } |
| 75 | + |
| 76 | + # --- Branch protection (main) --- |
| 77 | + |
| 78 | + branch_protection = { |
| 79 | + main = { |
| 80 | + # Require all conversations on a PR to be resolved before merge. |
| 81 | + required_conversation_resolution = true |
| 82 | + |
| 83 | + # Pull request review requirements before merge. |
| 84 | + required_pull_request_reviews = { |
| 85 | + # New commits dismiss previous approvals so reviewers re-check changes. |
| 86 | + dismiss_stale_reviews = true |
| 87 | + # At least one approving review from someone other than the author. |
| 88 | + required_approving_review_count = 1 |
| 89 | + } |
| 90 | + |
| 91 | + # CI must pass before merge; contexts must match the GitHub Actions job name. |
| 92 | + required_status_checks = { |
| 93 | + # Branch must be up to date with main before merging. |
| 94 | + strict = true |
| 95 | + contexts = ["ci"] |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | +} |
0 commit comments