Github Action Auto-Format runs several repository "hygiene" tasks for repositories:
readmetarget will rebuild
github_formattarget adds all of Cloud Posse's standard repository housekeeping files (including GitHub Actions workflows) to the repository's
terraform_formattarget ensures consistent formatting across all Terraform files in the repository.
If you haven't already, follow the steps in the quickstart section.
To choose which pieces of functionality will be executed, modify the
script-names: input to the
cloudposse/github-action-auto-format step to be a comma-separated list of one or more targets (e.g.,
This is an exhaustive list of all valid
terraform_formatIf you're using the
auto-format.ymlworkflow file distributed within this repository, then the Auto-format GitHub Action will trigger on pull request events, once a day at 7am UTC, and upon manual triggering via the
Here's how to get started...
.github/workflows/auto-format.ymlto the corresponding folder in your target repo.
- Generate a Personal Access Token (PAT) that with the
workflowpermission using a GitHub account that has
writepermissions in the target repo by following the directions here and selecting the
workflowtick box on the token creation screen.
- Add this token as a GitHub secret in your target repository and set the
workflow-tokeninput of the
github-action-auto-formatstep to the name of your secret.
- Set the
bot-nameinput of the
github-action-auto-formatstep to the GitHub username of the user who generated the token in step 2. *This user must have
writepermissions in the target repo.`
- By default, the Auto-Format GitHub Action will execute all of its scripts when run. If you'd like to use a subset of the full functionality, modify the
script-namesinput of the
github-action-auto-formatstep as described in the usage section.
- (Optional) You may want to change when the scheduled cron trigger is executed. If you'd like a guide, here's a useful resource for help in crafting cron strings - https://crontab.guru/
- (Optional) CloudPosse recommends pinning to specific versions of actions for ease of long-term maintenance. If you care to edit the pin in
mainto a specific version, feel free to consult https://github.com/cloudposse/github-action-auto-format/releases for a list of available versions.
Here's a real world example:
github-action-auto-format- Cloud Posse's self-testing Auto-Format GitHub Action