feat: Route filters module (#141) #88
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@692973e3d937129bcbf40652eb9f2f61becf3332 # 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 |