-
Notifications
You must be signed in to change notification settings - Fork 17
44 lines (41 loc) · 1.2 KB
/
build-terraform-docs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Build Terraform Docs
on:
pull_request_target:
branches:
- main
paths:
- '**/*.go'
- 'docs/**'
- 'templates/**'
- 'examples/**'
- .github/workflows/build-terraform-docs.yaml
permissions: {}
jobs:
build_tf_docs:
name: Build Terraform Docs
environment: Docs
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install tfplugindocs
run: go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
- name: Build Terraform Docs
run: make docs
- name: Commit changes
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
git add .
if [[ $(git diff --staged) != '' ]]; then
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Generate Terraform Docs"
git push --set-upstream origin ${{ env.HEAD_REF }}
else
echo "No changes to commit"
fi