Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pages support #16

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@ No modules.
| <a name="input_allow_rebase_merge"></a> [allow\_rebase\_merge](#input\_allow\_rebase\_merge) | Whether to allow rebase merges | `bool` | `true` | no |
| <a name="input_allow_squash_merge"></a> [allow\_squash\_merge](#input\_allow\_squash\_merge) | Whether to allow squash merges | `bool` | `true` | no |
| <a name="input_description"></a> [description](#input\_description) | The description of the repository | `string` | n/a | yes |
| <a name="input_enable_pages"></a> [enable\_pages](#input\_enable\_pages) | Whether to enable GitHub Pages | `bool` | `false` | no |
| <a name="input_gitignore_template"></a> [gitignore\_template](#input\_gitignore\_template) | The gitignore template of the repository | `string` | `null` | no |
| <a name="input_has_branch_protection"></a> [has\_branch\_protection](#input\_has\_branch\_protection) | Whether the repository has branch protection enabled | `bool` | `true` | no |
| <a name="input_has_discussions"></a> [has\_discussions](#input\_has\_discussions) | Whether the repository has discussions enabled | `bool` | `false` | no |
| <a name="input_has_issues"></a> [has\_issues](#input\_has\_issues) | Whether the repository has issues enabled | `bool` | `false` | no |
| <a name="input_has_projects"></a> [has\_projects](#input\_has\_projects) | Whether the repository has projects enabled | `bool` | `false` | no |
| <a name="input_has_wiki"></a> [has\_wiki](#input\_has\_wiki) | Whether the repository has wiki enabled | `bool` | `false` | no |
| <a name="input_homepage_url"></a> [homepage\_url](#input\_homepage\_url) | The URL of a page to use as the repository's home page | `string` | `null` | no |
| <a name="input_license_template"></a> [license\_template](#input\_license\_template) | Wheter the repository uses a license template | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | The name of the repository | `string` | n/a | yes |
| <a name="input_owner"></a> [owner](#input\_owner) | The owner of the repository | `string` | n/a | yes |
| <a name="input_pages_branch"></a> [pages\_branch](#input\_pages\_branch) | The branch to use for GitHub Pages | `string` | `null` | no |
| <a name="input_pages_build_type"></a> [pages\_build\_type](#input\_pages\_build\_type) | The build type of the GitHub Pages | `string` | `"workflow"` | no |
| <a name="input_pages_cname"></a> [pages\_cname](#input\_pages\_cname) | The custom domain of the GitHub Pages | `string` | `null` | no |
| <a name="input_pages_path"></a> [pages\_path](#input\_pages\_path) | The path to the GitHub Pages content | `string` | `null` | no |
| <a name="input_required_status_checks_contexts"></a> [required\_status\_checks\_contexts](#input\_required\_status\_checks\_contexts) | The list of status checks to require in order to merge into this branch | `list(string)` | `[]` | no |
| <a name="input_teams"></a> [teams](#input\_teams) | The teams to grant access to, and their permission levels | `map(string)` | `{}` | no |
| <a name="input_topics"></a> [topics](#input\_topics) | The topics of the repository | `list(string)` | `[]` | no |
Expand Down
15 changes: 15 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,27 @@ resource "github_repository" "self" {
has_issues = var.has_issues
has_projects = var.has_projects
has_wiki = var.has_wiki
homepage_url = var.homepage_url
is_template = false
license_template = var.license_template
name = var.name
topics = var.topics
visibility = var.visibility
vulnerability_alerts = var.vulnerability_alerts

dynamic "pages" {
for_each = var.enable_pages ? [1] : []

content {
build_type = var.pages_build_type
cname = var.pages_cname

source {
branch = var.pages_branch
path = var.pages_path
}
}
}
}

resource "github_branch_protection" "self" {
Expand Down
36 changes: 36 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ variable "description" {
type = string
}

variable "enable_pages" {
default = false
description = "Whether to enable GitHub Pages"
type = bool
}

variable "gitignore_template" {
default = null
description = "The gitignore template of the repository"
Expand Down Expand Up @@ -63,6 +69,12 @@ variable "has_wiki" {
type = bool
}

variable "homepage_url" {
default = null
description = "The URL of a page to use as the repository's home page"
type = string
}

variable "license_template" {
default = null
description = "Wheter the repository uses a license template"
Expand All @@ -79,6 +91,30 @@ variable "owner" {
type = string
}

variable "pages_branch" {
default = null
description = "The branch to use for GitHub Pages"
type = string
}

variable "pages_build_type" {
default = "workflow"
description = "The build type of the GitHub Pages"
type = string
}

variable "pages_cname" {
default = null
description = "The custom domain of the GitHub Pages"
type = string
}

variable "pages_path" {
default = null
description = "The path to the GitHub Pages content"
type = string
}

variable "required_status_checks_contexts" {
default = []
description = "The list of status checks to require in order to merge into this branch"
Expand Down
Loading