-
Notifications
You must be signed in to change notification settings - Fork 117
Add support for configuring default squash and merge commit titles and messages #137
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
3be6354
854465c
8b85b12
bcda3f9
fe7c4a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,18 +3,18 @@ | |
| [](https://github.com/mineiros-io/terraform-github-repository/actions) | ||
| [](https://github.com/mineiros-io/terraform-github-repository/releases) | ||
| [](https://github.com/hashicorp/terraform/releases) | ||
| [](https://github.com/terraform-providers/terraform-provider-github/releases) | ||
| [](https://github.com/terraform-providers/terraform-provider-github/releases) | ||
| [](https://join.slack.com/t/mineiros-community/shared_invite/zt-ehidestg-aLGoIENLVs6tvwJ11w9WGg) | ||
|
|
||
| # terraform-github-repository | ||
|
|
||
| A [Terraform] module for creating a public or private repository on [Github]. | ||
|
|
||
| **_This module supports Terraform v1.x and is compatible with the Official Terraform GitHub Provider v4.20 and above from `integrations/github`._** | ||
| **_This module supports Terraform v1.x and is compatible with the Official Terraform GitHub Provider v4.31 and above from `integrations/github`._** | ||
|
|
||
| **Attention: This module is incompatible with the Hashicorp GitHub Provider! The latest version of this module supporting `hashicorp/github` provider is `~> 0.10.0`** | ||
|
|
||
| ** Note: Versions 5.3.0, 5.4.0, and 5.5.0 of the Terraform Github Provider have broken branch protections support and should not be used.** | ||
| ** Note: Versions 5.3.0, 5.4.0, 5.5.0, and 5.6.0 of the Terraform Github Provider have broken branch protections support and should not be used.** | ||
|
|
||
|
|
||
| - [GitHub as Code](#github-as-code) | ||
|
|
@@ -89,7 +89,8 @@ features like Branch Protection or Collaborator Management. | |
| Teams, | ||
| Deploy Keys, | ||
| Projects, | ||
| Repository Webhooks | ||
| Repository Webhooks, | ||
| GitHub App Installations | ||
|
|
||
| - _Features not yet implemented_: | ||
| Project Columns support, | ||
|
|
@@ -103,7 +104,7 @@ Most basic usage creating a new private github repository. | |
| ```hcl | ||
| module "repository" { | ||
| source = "mineiros-io/repository/github" | ||
| version = "~> 0.16.0" | ||
| version = "~> 0.18.0" | ||
|
|
||
| name = "terraform-github-repository" | ||
| license_template = "apache-2.0" | ||
|
|
@@ -147,18 +148,28 @@ See [variables.tf] and [examples/] for details and use-cases. | |
| `has_issues`, | ||
| `has_projects`, | ||
| `has_wiki`, | ||
| `has_downloads`, | ||
| `delete_branch_on_merge`, | ||
| `is_template`, | ||
| `allow_merge_commit`, | ||
| `allow_rebase_merge`, | ||
| `allow_squash_merge`, | ||
| `allow_auto_merge`, | ||
| `has_downloads`, | ||
| `auto_init`, | ||
| `gitignore_template`, | ||
| `license_template`, | ||
| `squash_merge_commit_title`, | ||
| `squash_merge_commit_message`, | ||
| `merge_commit_title`, | ||
| `merge_commit_message`, | ||
| `auto_init`, | ||
| `default_branch`, | ||
| `topics`, | ||
| `issue_labels_create`, | ||
| `issue_labels_merge_with_github_labels`. | ||
| `issue_labels_merge_with_github_labels`, | ||
| `vulnerability_alerts`, | ||
| `ignore_vulnerability_alerts_during_read`, | ||
| `template`. | ||
|
|
||
| Module defaults are used for all arguments that are not set in `defaults`. | ||
| Using top level arguments override defaults set by this argument. | ||
|
|
@@ -216,6 +227,30 @@ See [variables.tf] and [examples/] for details and use-cases. | |
|
|
||
| Default is `false`. | ||
|
|
||
| - [**`squash_merge_commit_title`**](#var-squash_merge_commit_title): *(Optional `string`)*<a name="var-squash_merge_commit_title"></a> | ||
|
|
||
| Set to `PR_TITLE` or `COMMIT_OR_PR_TITLE` for a default squash merge commit title. | ||
|
|
||
| Default is `"COMMIT_OR_PR_TITLE"`. | ||
|
|
||
| - [**`squash_merge_commit_message`**](#var-squash_merge_commit_message): *(Optional `string`)*<a name="var-squash_merge_commit_message"></a> | ||
|
|
||
| Set to `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message. | ||
|
|
||
| Default is `"COMMIT_MESSAGES"`. | ||
|
|
||
| - [**`merge_commit_title`**](#var-merge_commit_title): *(Optional `string`)*<a name="var-merge_commit_title"></a> | ||
|
|
||
| Set to `PR_TITLE` or `MERGE_MESSAGE` for a default merge commit title. | ||
|
|
||
| Default is `"MERGE_MESSAGE"`. | ||
|
|
||
| - [**`merge_commit_message`**](#var-merge_commit_message): *(Optional `string`)*<a name="var-merge_commit_message"></a> | ||
|
|
||
| Set to `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message. | ||
|
|
||
| Default is `"PR_TITLE"`. | ||
|
|
||
| - [**`description`**](#var-description): *(Optional `string`)*<a name="var-description"></a> | ||
|
|
||
| A description of the repository. | ||
|
|
@@ -310,6 +345,10 @@ See [variables.tf] and [examples/] for details and use-cases. | |
| Set to `false` to disable security alerts for vulnerable dependencies. | ||
| Enabling requires alerts to be enabled on the owner level. | ||
|
|
||
| - [**`ignore_vulnerability_alerts_during_read`**](#var-ignore_vulnerability_alerts_during_read): *(Optional `bool`)*<a name="var-ignore_vulnerability_alerts_during_read"></a> | ||
|
|
||
| Set to `true` to not call the vulnerability alerts endpoint so the resource can also be used without admin permissions during read. | ||
|
|
||
| - [**`archive_on_destroy`**](#var-archive_on_destroy): *(Optional `bool`)*<a name="var-archive_on_destroy"></a> | ||
|
|
||
| Set to `false` to not archive the repository instead of deleting on destroy. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,14 +11,14 @@ locals { | |
| visibility = var.visibility == null ? lookup(var.defaults, "visibility", local.private_visibility) : var.visibility | ||
| has_issues = var.has_issues == null ? lookup(var.defaults, "has_issues", false) : var.has_issues | ||
| has_projects = var.has_projects == null ? lookup(var.defaults, "has_projects", false) : length(var.projects) > 0 ? true : var.has_projects | ||
| has_downloads = var.has_downloads == null ? lookup(var.defaults, "has_downloads", false) : var.has_downloads | ||
| has_wiki = var.has_wiki == null ? lookup(var.defaults, "has_wiki", false) : var.has_wiki | ||
| allow_merge_commit = var.allow_merge_commit == null ? lookup(var.defaults, "allow_merge_commit", true) : var.allow_merge_commit | ||
| allow_rebase_merge = var.allow_rebase_merge == null ? lookup(var.defaults, "allow_rebase_merge", false) : var.allow_rebase_merge | ||
| allow_squash_merge = var.allow_squash_merge == null ? lookup(var.defaults, "allow_squash_merge", false) : var.allow_squash_merge | ||
| allow_auto_merge = var.allow_auto_merge == null ? lookup(var.defaults, "allow_auto_merge", false) : var.allow_auto_merge | ||
| delete_branch_on_merge = var.delete_branch_on_merge == null ? lookup(var.defaults, "delete_branch_on_merge", true) : var.delete_branch_on_merge | ||
| is_template = var.is_template == null ? lookup(var.defaults, "is_template", false) : var.is_template | ||
| has_downloads = var.has_downloads == null ? lookup(var.defaults, "has_downloads", false) : var.has_downloads | ||
| auto_init = var.auto_init == null ? lookup(var.defaults, "auto_init", true) : var.auto_init | ||
| gitignore_template = var.gitignore_template == null ? lookup(var.defaults, "gitignore_template", "") : var.gitignore_template | ||
| license_template = var.license_template == null ? lookup(var.defaults, "license_template", "") : var.license_template | ||
|
|
@@ -29,6 +29,11 @@ locals { | |
| issue_labels_create = var.issue_labels_create == null ? lookup(var.defaults, "issue_labels_create", local.issue_labels_create_computed) : var.issue_labels_create | ||
| branch_protections_v3 = var.branch_protections_v3 == null ? var.branch_protections : var.branch_protections_v3 | ||
|
|
||
| squash_merge_commit_title = local.allow_squash_merge ? var.squash_merge_commit_title == null ? try(var.defaults.squash_merge_commit_title, null) : var.squash_merge_commit_title : null | ||
| squash_merge_commit_message = local.allow_squash_merge ? var.squash_merge_commit_title == null ? try(var.defaults.squash_merge_commit_title, null) : var.squash_merge_commit_title : null | ||
| merge_commit_title = local.allow_merge_commit ? var.merge_commit_title == null ? try(var.defaults.merge_commit_title, null) : var.merge_commit_title : null | ||
| merge_commit_message = local.allow_merge_commit ? var.merge_commit_message == null ? try(var.merge_commit_message, null) : var.merge_commit_message : null | ||
|
|
||
|
||
| issue_labels_create_computed = local.has_issues || length(var.issue_labels) > 0 | ||
|
|
||
| # for readability | ||
|
|
@@ -37,7 +42,8 @@ locals { | |
|
|
||
| issue_labels_merge_with_github_labels = local.gh_labels | ||
| # Per default, GitHub activates vulnerability alerts for public repositories and disables it for private repositories | ||
| vulnerability_alerts = var.vulnerability_alerts != null ? var.vulnerability_alerts : local.private ? false : true | ||
| vulnerability_alerts = var.vulnerability_alerts != null ? var.vulnerability_alerts : local.private ? false : true | ||
| ignore_vulnerability_alerts_during_read = var.ignore_vulnerability_alerts_during_read == null ? try(var.defaults.ignore_vulnerability_alerts_during_read, null) : var.ignore_vulnerability_alerts_during_read | ||
| } | ||
|
|
||
| locals { | ||
|
|
@@ -113,6 +119,11 @@ resource "github_repository" "repository" { | |
| archive_on_destroy = var.archive_on_destroy | ||
| vulnerability_alerts = local.vulnerability_alerts | ||
|
|
||
| squash_merge_commit_title = local.squash_merge_commit_title | ||
| squash_merge_commit_message = local.squash_merge_commit_message | ||
| merge_commit_title = local.merge_commit_title | ||
| merge_commit_message = local.merge_commit_message | ||
|
|
||
| dynamic "template" { | ||
| for_each = local.template | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.