This repository automates the creation and management of GitHub repositories, teams, and environments. Automation is triggered by Port and executed through GitHub Actions workflows using Terraform for provisioning.
repositories/- Terraform module to manage GitHub repositories.teams/- Terraform module for GitHub teams..github/workflows/- GitHub Actions workflows..github/actions/- Reusable GitHub Actions.
Port catalog updates and run status reporting leverage the official port-labs/port-github-action.
Refer to AGENTS.md for design decisions and the task list.
Repository templates include .provisioning/repository-config.yml, a YAML file
that defines initial settings such as branch rulesets, default labels, team
permissions, Actions variables and secrets. The create-repository workflow
parses this file in a Configure repository block and applies it using the
modules/github-initial-config Terraform module. The block:
- Clones the template to read
.provisioning/repository-config.yml. - Maps any
workflow_secretreferences in the file to provided secrets. - Runs the module to create rulesets, labels, team access, variables and secrets.
- Removes the local Terraform directory and state files, keeping this configuration state ephemeral.
The GitHub Actions workflows rely on several repository secrets (and optionally variables) for authentication and state management. Configure the following in the repository settings before running the workflows:
GH_APP_ID– GitHub App identifier used to mint installation tokensGH_APP_PRIVATE_KEY– private key for the GitHub AppGH_APP_INSTALLATION_ID– installation ID of the GitHub App in the organizationAZURE_CLIENT_ID– Azure AD application (service principal) client ID for OIDCAZURE_TENANT_ID– Azure AD tenant IDAZURE_SUBSCRIPTION_ID– Azure subscription containing the storage accountAZURE_RESOURCE_GROUP– resource group of the storage accountAZURE_STORAGE_ACCOUNT– Azure Storage account for Terraform stateAZURE_STORAGE_CONTAINER– container name for Terraform state filesPORT_CLIENT_ID– Port OAuth client IDPORT_CLIENT_SECRET– Port OAuth client secretCOOKIECUTTER_GIT_AUTH– (optional) token for private cookiecutter templates
The GitHub organization is derived from the repository owner (github.repository_owner), so no separate GH_ORG secret is needed.
Currently none are required, but repository variables can be added for non‑sensitive configuration.
Sample Port payloads live under tests/payloads/ for running workflows
locally with act. The companion
tests/README.md explains how to execute workflows with these payloads
and how to run a mock invocation using --dryrun.
CI enforces actionlint,
tflint, and
terraform validate on all modules. Run these checks locally before
submitting changes:
actionlint
terraform -chdir=repositories/modules/repo init -backend=false
terraform -chdir=repositories/modules/repo validate
tflint --chdir repositories/modules/repo
terraform -chdir=teams/modules/team init -backend=false
terraform -chdir=teams/modules/team validate
tflint --chdir teams/modules/team