Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ if command_exists typos; then
echo "$files" | xargs typos
fi

if command_exists terraform-docs; then
pushd asset-account/terraform/stack-set
files="$files asset-account/terraform/stack-set/README.md"

terraform-docs markdown . --output-file README.md
popd
fi

if command_exists ./node_modules/.bin/prettier; then
echo "$files" | xargs ./node_modules/.bin/prettier --ignore-unknown --write
fi
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,44 @@ jobs:
- run: terraform validate
working-directory: ${{ matrix.project }}

terraform-docs:
runs-on: ubuntu-latest

strategy:
matrix:
terraform_module:
- asset-account/terraform/stack-set

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- run: npm ci --ignore-scripts

- run: |
curl https://github.com/terraform-docs/terraform-docs/releases/download/v0.19.0/terraform-docs-v0.19.0-linux-amd64.tar.gz \
--location \
--silent \
--retry 5 \
--retry-all-errors \
--show-error \
| tar -xz terraform-docs > ./terraform-docs
working-directory: ${{ matrix.terraform_module }}

- run: chmod +x ./terraform-docs
working-directory: ${{ matrix.terraform_module }}

- run: ./terraform-docs markdown . --output-file README.md
working-directory: ${{ matrix.terraform_module }}

- run: npx prettier -w .

- run: >-
git diff --exit-code --color=always || ( echo "Terraform docs are
out-of-date. See the diff above." && exit 1 )

prettier:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
terraform.tfstate
terraform.tfstate.backup
terraform.tfvars
/node_modules
Loading