-
Notifications
You must be signed in to change notification settings - Fork 3
67 lines (59 loc) · 2.45 KB
/
documentation.yaml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: generate-terraform-docs
# This workflow will generate terraform docs into README.md in the root, examples, and modules folders.
# Source: https://github.com/equinix-labs/terraform-equinix-kubernetes-addons/blob/main/.github/workflows/documentation.yaml
on:
push:
branches:
- main
paths:
- '**/*.tpl'
- '**/*.tf'
workflow_dispatch:
jobs:
tf-docs:
name: TF docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
id: actions-checkout
with:
ref: main
- name: Install terraform-docs
run: |
curl -sSLo ./terraform-docs.tar.gz https://terraform-docs.io/dl/v0.18.0/terraform-docs-v0.18.0-$(uname)-amd64.tar.gz
tar -xzf terraform-docs.tar.gz
chmod +x terraform-docs
mv terraform-docs /usr/local/bin/terraform-docs
rm -rf terraform-docs.tar.gz
git restore *
- name: Render Terraform docs inside the README.md files of examples
run: |
find examples -type d -mindepth 1 -maxdepth 1 | while read dir; do
terraform-docs -c "./templates/examples-terraform-docs.yaml" --output-file "README.md" "$dir"
done
- name: Render Terraform docs inside the README.md files of modules
run: |
find modules -type d -mindepth 1 -maxdepth 1 | while read dir; do
terraform-docs -c "./templates/modules-terraform-docs.yaml" --output-file "README.md" "$dir"
done
- name: Replace EXAMPLE_PATH placeholders inside the README.md files of examples
run: |
find examples -name "README.md" | while read file; do
dir_name=$(basename "$(dirname "$file")")
sed -i "s@EXAMPLE_PATH@$dir_name@g" "$file"
sed -i "s@\.\.\/\.\.@equinix\/fabric\/equinix\/@" "$file"
done
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
commit-message: 'generate-terraform-docs: automated action'
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: 'Generate-terraform-docs: Automated action'
body: |
Update terraform docs
branch-suffix: timestamp
signoff: true
base: main
delete-branch: true
# TODO(ocobleseqx): https://github.com/peter-evans/enable-pull-request-automerge