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@v19 id: verify-changed-files with: files: | README.md - name: Commit and push new terraform docs version if: steps.verify-changed-files.outputs.files_changed == 'true' uses: stefanzweifel/git-auto-commit-action@v4 with: branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }} commit_message: "docs(tf-docs): update docs" commit_user_name: Gitea Bot commit_user_email: bot@git.palkoi.net # - 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 "bot@git.palkoi.net" # git add README.md # git status # git commit -m 'docs(tf-docs): update README.md' # git push