Skip to content

Commit

Permalink
build: added auto generation for tf docs on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-s committed May 29, 2024
1 parent 9539dc2 commit f99b369
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: docs

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
generate:
name: Generate docs
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Install tfplugindocs
run: |
export GOBIN=$PWD/bin
export PATH=$GOBIN:$PATH
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
which tfplugindocs
- name: Generate docs
run: |
export GOBIN=$PWD/bin
export PATH=$GOBIN:$PATH
tfplugindocs generate --rendered-provider-name Qernal
echo "Generated files:"
git status --porcelain
- name: Commit changes
run: |
# commit client (if changes have been made)
if [ -n "$(git status --porcelain)" ]; then
echo "Committing changes..."
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git add docs/
git commit -m "docs: updated tf provider docs"
echo "${{ github.GITHUB_HEAD_REF }}"
# git push origin ${{ github.GITHUB_HEAD_REF }}
fi

0 comments on commit f99b369

Please sign in to comment.