Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): add workflow to generate documentation on PR merge #12681

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check
name: Check and Generate

on:
pull_request:
Expand Down Expand Up @@ -33,8 +33,6 @@ jobs:
- uses: ./.github/actions/make-deps
- run: make gen
- run: git diff --exit-code
- run: make docsgen-cli
- run: git diff --exit-code
check-lint:
name: Check (lint-all)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -70,3 +68,37 @@ jobs:
- uses: ./.github/actions/install-go
- run: go mod tidy -v
- run: git diff --exit-code
generate-docs:
name: Generate Documentation
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/'))
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0

- uses: ./.github/actions/install-system-dependencies
- uses: ./.github/actions/install-go
- uses: ./.github/actions/make-deps

- name: Generate API documentation using docsgen-cli
run: |
make docsgen-cli || {
echo "Error: Documentation generation failed"
exit 1
}

- name: Commit and push if documentation changed
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
git add .
git commit -m "docs: update API documentation via docsgen-cli"
BigLep marked this conversation as resolved.
Show resolved Hide resolved
git push
else
echo "No documentation changes to commit"
fi