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
10 changes: 4 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,19 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
submodules: "recursive"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should check your editor and remove these auto-fix rules that you have, it's generally not good manners to go editing things unrelated to what you're intending to change without good reason to do so

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@virajbhartiya Also single quote and double quote have specific meaning in YAML, similar to bash. Here, single quote is appropriate because there are no special characters expected/acceptable in recursive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, my linter was automatically replacing the quotes, fixed it

- uses: ./.github/actions/install-system-dependencies
- uses: ./.github/actions/install-go
- 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
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
submodules: "recursive"
- uses: ./.github/actions/install-system-dependencies
- uses: ./.github/actions/install-go
- uses: ./.github/actions/make-deps
Expand All @@ -52,7 +50,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
submodules: "recursive"
- uses: ./.github/actions/install-go
- run: go fmt ./...
- run: git diff --exit-code
Expand All @@ -62,7 +60,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
submodules: "recursive"
- uses: ./.github/actions/install-go
- run: go mod tidy -v
- run: git diff --exit-code
34 changes: 34 additions & 0 deletions .github/workflows/docsgen-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Generate Documentation

virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
permissions:
contents: write

on:
pull_request:
types: [closed]
branches:
- master

jobs:
generate-docs:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Generate documentation
run: make docsgen-cli

- name: Commit and push generated docs
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name "GitHub Actions"
git config user.email [email protected]
git add .
git commit --amend --no-edit
git push --force
else
echo "No changes to commit"
fi