Skip to content

Commit

Permalink
refactor: use authenticated user data for commit author and email; re…
Browse files Browse the repository at this point in the history
…move commit_email variable
  • Loading branch information
Your Name committed Sep 11, 2025
1 parent 4f1e581 commit 5505602
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 11 additions & 6 deletions github_files.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Retrieve information about the currently authenticated user.
data "github_user" "current" {
username = ""
}

locals {
# Process files only if commit signing is not required or if explicitly allowed
should_manage_files = ! try(local.github_repo.require_signed_commits, false) || var.allow_unsigned_files
Expand All @@ -12,8 +17,8 @@ resource "github_repository_file" "codeowners" {
file = "CODEOWNERS"
content = templatefile("${path.module}/templates/CODEOWNERS", { codeowners = local.codeowners })
commit_message = "Update CODEOWNERS file"
commit_author = var.commit_author
commit_email = var.commit_email
commit_author = data.github_user.current.name
commit_email = data.github_user.current.email
overwrite_on_create = true
depends_on = [
github_repository.repo
Expand Down Expand Up @@ -63,8 +68,8 @@ resource "github_repository_file" "extra_files" {
file = each.value.path
content = each.value.content
commit_message = "Update ${each.value.path}"
commit_author = var.commit_author
commit_email = var.commit_email
commit_author = data.github_user.current.name
commit_email = data.github_user.current.email
overwrite_on_create = true
depends_on = [
github_repository.repo
Expand All @@ -85,8 +90,8 @@ resource "github_repository_file" "managed_extra_files" {
file = each.value.path
content = each.value.content
commit_message = "Update ${each.value.path}"
commit_author = var.commit_author
commit_email = var.commit_email
commit_author = data.github_user.current.name
commit_email = data.github_user.current.email
overwrite_on_create = true
depends_on = [
github_repository.repo
Expand Down
6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,6 @@ variable "commit_author" {
default = "Terraform"
}

variable "commit_email" {
description = "The email to use for file commits"
type = string
default = "terraform@roknsound.com"
}

variable "require_signed_commits" {
description = "Whether to require signed commits for the default branch"
type = bool
Expand Down

0 comments on commit 5505602

Please sign in to comment.