Skip to content

Commit

Permalink
ci(docs): Require up-to-date function docs
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <[email protected]>
  • Loading branch information
hairyhenderson committed May 12, 2024
1 parent ab982b5 commit 911e28c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Docs Checks
on:
pull_request:
branches: [ main ]

jobs:
check-func-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install gomplate
run: |
docker create --name gomplate hairyhenderson/gomplate
docker cp gomplate:/gomplate .
sudo mv gomplate /usr/local/bin
- name: Make sure function docs are up-to-date
run: |
make --always-make gen-func-docs
git diff --exit-code
if [ $? -ne 0 ]; then
echo "Function docs are out of date. Please run 'make gen-func-docs' locally and commit the changes."
exit 1
fi
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ gen-docs: docs/themes/hugo-theme-relearn
docs/content/functions/%.md: docs-src/content/functions/%.yml docs-src/content/functions/func_doc.md.tmpl
gomplate -d data=$< -f docs-src/content/functions/func_doc.md.tmpl -o $@

# run the above target for all files found in docs-src/content/functions/*.yml
gen-func-docs: $(shell find docs-src/content/functions -name "*.yml" | sed -e 's#docs-src#docs#' -e 's#\.yml#\.md#')

# this target doesn't usually get used - it's mostly here as a reminder to myself
# hint: make sure CLOUDCONVERT_API_KEY is set ;)
gomplate.png: gomplate.svg
Expand All @@ -224,6 +227,6 @@ lint:
ci-lint:
@golangci-lint run --verbose --max-same-issues=0 --max-issues-per-linter=0 --out-format=github-actions

.PHONY: gen-changelog clean test build-x build-release build test-integration-docker gen-docs lint clean-images clean-containers docker-images test-remote-windows integration testbins-windows
.PHONY: gen-changelog clean test build-x build-release build test-integration-docker gen-docs lint clean-images clean-containers docker-images test-remote-windows integration testbins-windows gen-func-docs
.DELETE_ON_ERROR:
.SECONDARY:

0 comments on commit 911e28c

Please sign in to comment.