Skip to content

Doc synchronization #103

Doc synchronization

Doc synchronization #103

Workflow file for this run

# Check docs are up-to-date only on pull request.
# Succeeds if it is.
# Fail if not, generates a new version then commits it.
name: Docs synchronization
permissions:
contents: write
pull-requests: write
on:
pull_request:
branches: [master]
workflow_dispatch:
jobs:
docs-synch:
name: Auto-updates docs on pull requests when needed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Get dependencies
run: go mod download
- name: Install tfplugindocs
run: go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
- name: Run tfplugindocs
run: go generate ./...
- name: Fail if any files changed
shell: bash
continue-on-error: true
run: |
if [[ $(git status --porcelain=v1 docs/ | wc -l) -ne 0 ]]; then
echo "docs/ needs an update"
echo "Changed files:"
git diff docs/
git status docs/
exit 1
fi
- name: Commit docs update
if: |
failure()
run: |
git config user.name "Github Actions docs synchronizer Bot"
git config user.email "actions@github.com"
echo "test commit docs update"