forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-tf-docs.yml
More file actions
53 lines (47 loc) 路 1.78 KB
/
Copy pathupdate-tf-docs.yml
File metadata and controls
53 lines (47 loc) 路 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Update Terraform Docs
on:
pull_request:
paths:
- 'infrastructure/terraform/**/*.tf'
push:
branches: [main]
paths:
- 'infrastructure/terraform/**/*.tf'
jobs:
terraform-docs:
name: Generate terraform-docs
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install terraform-docs
run: |
VERSION=v0.17.0
curl -sSLo terraform-docs.tar.gz \
"https://github.com/terraform-docs/terraform-docs/releases/download/${VERSION}/terraform-docs-${VERSION}-linux-amd64.tar.gz"
tar -xzf terraform-docs.tar.gz terraform-docs
chmod +x terraform-docs
sudo mv terraform-docs /usr/local/bin/
- name: Generate docs for all modules
run: |
terraform-docs --config infrastructure/terraform/.terraform-docs.yml \
markdown table infrastructure/terraform/ \
> infrastructure/docs/modules/terraform-modules.md
echo "Root module docs generated."
for mod in infrastructure/terraform/modules/*/; do
modname=$(basename "$mod")
terraform-docs --config infrastructure/terraform/.terraform-docs.yml \
markdown table "$mod" \
> "infrastructure/docs/modules/${modname}.md"
echo "Module ${modname} docs generated."
done
- name: Commit updated docs
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'docs(terraform): auto-update module documentation [skip ci]'
file_pattern: 'infrastructure/docs/modules/*.md infrastructure/terraform/README.md'