-
Notifications
You must be signed in to change notification settings - Fork 12
35 lines (27 loc) · 1.04 KB
/
generate_docs.yml
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
name: Generate Terraform Plugin Documentation
on:
pull_request:
branches:
- main
- stable-*
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Install dependencies
run: go get .
- name: Install tfplugindocs
run: go get github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest
- name: Build
run: go build -v ./...
- name: Generate documentation
run: make generatedocs
- name: Use GITHUB_TOKEN to commit changes
run: |
git diff --exit-code || (echo "Generated docs have changed, committing the changes." && git config user.name "${{ github.repository_owner }}" && git -c "user.name=${{ github.actor }}" -c "user.email=${{ github.actor }}@users.noreply.github.com" commit -am "Update generated docs (${GITHUB_SHA})" && git push origin HEAD:${{ github.head_ref }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}