|
| 1 | +name: Terraform Docs |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - '**.tf' |
| 8 | + - '.terraform-docs.yml' |
| 9 | + |
| 10 | +jobs: |
| 11 | + docs: |
| 12 | + name: Generate Docs |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + ref: ${{ github.event.pull_request.head.ref }} |
| 20 | + |
| 21 | + - name: Generate docs for modules/flash-nodes |
| 22 | + uses: terraform-docs/gh-actions@v1 |
| 23 | + with: |
| 24 | + working-dir: modules/flash-nodes |
| 25 | + config-file: .terraform-docs.yml |
| 26 | + output-file: README.md |
| 27 | + output-method: inject |
| 28 | + git-push: false |
| 29 | + |
| 30 | + - name: Generate docs for modules/k3s-cluster |
| 31 | + uses: terraform-docs/gh-actions@v1 |
| 32 | + with: |
| 33 | + working-dir: modules/k3s-cluster |
| 34 | + config-file: .terraform-docs.yml |
| 35 | + output-file: README.md |
| 36 | + output-method: inject |
| 37 | + git-push: false |
| 38 | + |
| 39 | + - name: Generate docs for modules/talos-cluster |
| 40 | + uses: terraform-docs/gh-actions@v1 |
| 41 | + with: |
| 42 | + working-dir: modules/talos-cluster |
| 43 | + config-file: .terraform-docs.yml |
| 44 | + output-file: README.md |
| 45 | + output-method: inject |
| 46 | + git-push: false |
| 47 | + |
| 48 | + - name: Generate docs for modules/addons/metallb |
| 49 | + uses: terraform-docs/gh-actions@v1 |
| 50 | + with: |
| 51 | + working-dir: modules/addons/metallb |
| 52 | + config-file: .terraform-docs.yml |
| 53 | + output-file: README.md |
| 54 | + output-method: inject |
| 55 | + git-push: false |
| 56 | + |
| 57 | + - name: Generate docs for modules/addons/ingress-nginx |
| 58 | + uses: terraform-docs/gh-actions@v1 |
| 59 | + with: |
| 60 | + working-dir: modules/addons/ingress-nginx |
| 61 | + config-file: .terraform-docs.yml |
| 62 | + output-file: README.md |
| 63 | + output-method: inject |
| 64 | + git-push: false |
| 65 | + |
| 66 | + - name: Generate docs for modules/addons/longhorn |
| 67 | + uses: terraform-docs/gh-actions@v1 |
| 68 | + with: |
| 69 | + working-dir: modules/addons/longhorn |
| 70 | + config-file: .terraform-docs.yml |
| 71 | + output-file: README.md |
| 72 | + output-method: inject |
| 73 | + git-push: false |
| 74 | + |
| 75 | + - name: Generate docs for modules/addons/monitoring |
| 76 | + uses: terraform-docs/gh-actions@v1 |
| 77 | + with: |
| 78 | + working-dir: modules/addons/monitoring |
| 79 | + config-file: .terraform-docs.yml |
| 80 | + output-file: README.md |
| 81 | + output-method: inject |
| 82 | + git-push: false |
| 83 | + |
| 84 | + - name: Generate docs for modules/addons/portainer |
| 85 | + uses: terraform-docs/gh-actions@v1 |
| 86 | + with: |
| 87 | + working-dir: modules/addons/portainer |
| 88 | + config-file: .terraform-docs.yml |
| 89 | + output-file: README.md |
| 90 | + output-method: inject |
| 91 | + git-push: false |
| 92 | + |
| 93 | + - name: Check for changes |
| 94 | + id: changes |
| 95 | + run: | |
| 96 | + if git diff --quiet; then |
| 97 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 98 | + else |
| 99 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 100 | + fi |
| 101 | +
|
| 102 | + - name: Commit and push |
| 103 | + if: steps.changes.outputs.changed == 'true' |
| 104 | + run: | |
| 105 | + git config user.name "github-actions[bot]" |
| 106 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 107 | + git add -A |
| 108 | + git commit -m "docs: auto-generate module documentation" |
| 109 | + git push |
0 commit comments