Files
actions/.gitea/workflows/tf-docs.yml

42 lines
1.4 KiB
YAML

name: tf-docs
on:
workflow_call:
jobs:
tf-docs:
name: tf-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install terraform docs
shell: bash
working-directory: /tmp
run: |
curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-$(uname)-amd64.tar.gz
tar -xzvf terraform-docs.tar.gz
chmod +x terraform-docs
mv terraform-docs /usr/local/bin/terraform-docs
- name: Generate terraform docs and push the changes back to PR branch
shell: bash
run: |
terraform-docs --version
terraform-docs markdown table --output-file README.md --output-mode inject .
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: |
README.md
- name: Push updated README.md
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --global user.name "Gitea Bot"
git config --global user.email "gitea@xaked.com"
git add README.md
git status
git commit -m 'docs(tf-docs): update README.md'
git push