/github-repo-configs

GitHub auto config setting script with GitHub Actions & Terraform GitHub Provider.

Primary LanguageHCLMIT LicenseMIT

github-repo-configs

Badge

GitHub auto config setting script with GitHub Actions & Terraform GitHub Provider.

  • Public personal repository are setting automatically you desired.
  • States are automatically controlled if you created,archived or deleted repository.

Usage

Requirement

Topic options

This config uses GitHub topics for setting options. If you have any special repository, please set below topic.

  • no-codeowners: .github/CODEOWNERS file isn't created.
  • no-branch-protection: Branch Protection Rule isn't created.

Command(local)

export GITHUB_REPOSITORY_OWNER="your-github-username"
export GITHUB_TOKEN="ghp_XXXX"
export TF_CLOUD_ORGANIZATION="your-org-name"
export TF_WORKSPACE="your-workspace-name"
export TF_TOKEN_app_terraform_io="XXXXXX......XXXXXX"

terraform init
./.github/workflows/prepare.sh
terraform apply

GitHub Actions(CI)

  • Please set secret below.
    • TF_CLOUD_ORGANIZATION
    • TF_WORKSPACE
    • TF_API_TOKEN (same with TF_TOKEN_app_terraform_io)
    • WRITABLE_GITHUB_TOKEN (same with GITHUB_TOKEN)
  • and execute terraform plan & terraform apply action.