Skip to content

Commit 16972b2

Browse files
authored
Check that the API docs are up to date on CI (#1490)
Signed-off-by: lujunsan <[email protected]>
1 parent 217bf2e commit 16972b2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/verify-docgen.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ jobs:
1515
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
1616
with:
1717
go-version-file: go.mod
18+
- name: Install swag
19+
run: go install github.com/swaggo/swag/v2/cmd/swag@latest
1820
- run: ./cmd/help/verify.sh

cmd/help/verify.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
# Verify that generated Markdown docs are up-to-date.
4+
# Verify that generated CLI docs are up-to-date.
55
tmpdir=$(mktemp -d)
66
go run cmd/help/main.go --dir "$tmpdir"
77
diff -Naur -I "^ date:" "$tmpdir" docs/cli/
8+
9+
# Generate API docs in temp directory that mimics the final structure
10+
api_tmpdir=$(mktemp -d)
11+
mkdir -p "$api_tmpdir/server"
12+
swag init -g pkg/api/server.go --v3.1 -o "$api_tmpdir/server"
13+
# Exclude README.md from diff as it's manually maintained
14+
diff -Naur --exclude="README.md" "$api_tmpdir/server" docs/server/
15+
816
echo "######################################################################################"
917
echo "If diffs are found, please run: \`task docs\` to regenerate the docs."
1018
echo "######################################################################################"

0 commit comments

Comments
 (0)