|
| 1 | +# This is a Terraform-managed file; manual changes will be overwritten. |
| 2 | +# see https://github.com/workloads/github-organization/blob/main/templates/workflows/terraform-docs.tftpl.yml |
| 3 | + |
| 4 | +--- |
| 5 | + |
| 6 | +name: "Documentation: terraform-docs" |
| 7 | + |
| 8 | +# yamllint disable-line rule:truthy |
| 9 | +on: |
| 10 | + push: |
| 11 | + |
| 12 | +# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions |
| 13 | +permissions: read-all |
| 14 | + |
| 15 | +jobs: |
| 16 | + workflow: |
| 17 | + # only run if workflows are enabled |
| 18 | + if: ${{ vars.ENABLE_WORKFLOWS == 'true' }} |
| 19 | + |
| 20 | + # see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency |
| 21 | + concurrency: |
| 22 | + group: "${{ github.workflow }}-${{ github.ref }}" |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | + name: Terraform Docs |
| 26 | + |
| 27 | + # see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions |
| 28 | + permissions: |
| 29 | + contents: write |
| 30 | + |
| 31 | + runs-on: ubuntu-latest |
| 32 | + timeout-minutes: 10 |
| 33 | + |
| 34 | + steps: |
| 35 | + # see https://github.com/actions/checkout/releases/tag/v4.2.2 |
| 36 | + - name: Checkout Repository |
| 37 | + uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" # ref: `tags/v4.2.2` |
| 38 | + with: |
| 39 | + ref: "${{ github.event.pull_request.head.ref }}" |
| 40 | + fetch-depth: 1 |
| 41 | + |
| 42 | + # see https://github.com/terraform-docs/gh-actions/releases/tag/v1.4.1 |
| 43 | + - name: Render documentation for repository and push changes back to branch |
| 44 | + uses: "terraform-docs/gh-actions@6de6da0cefcc6b4b7a5cbea4d79d97060733093c" # ref: `tags/v1.4.1` |
| 45 | + with: |
| 46 | + config-file: ".terraform-docs.yml" |
| 47 | + output-file: "README.md" |
| 48 | + output-method: inject" |
| 49 | + git-push: true |
| 50 | + working-dir: "./" |
| 51 | + |
| 52 | + workflow-inactive: |
| 53 | + # only run if workflows are disabled |
| 54 | + if: ${{ vars.ENABLE_WORKFLOWS != 'true' }} |
| 55 | + |
| 56 | + name: Workflow Status |
| 57 | + runs-on: ubuntu-latest |
| 58 | + timeout-minutes: 1 |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Display Workflow Status |
| 62 | + # shellcheck disable=SC2006 |
| 63 | + run: echo "::notice title='Workflow is not currently active'::'Check if `ENABLE_WORKFLOWS` is set to `true`.'" |
0 commit comments