Skip to content

feat(ci): enusure docs are up-to-date for PRs #686

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

Merged
merged 2 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ relates to #1234
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see e.g. [here](https://github.com/stackitcloud/stackit-cli/blob/ef291d1683ca5b0d719ec0a26ecb999a32685117/internal/cmd/ske/cluster/create/create.go#L49-L63))
- [ ] Docs are up-to-date: `make generate-docs`
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
7 changes: 7 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
uses: ./.github/actions/build
with:
go-version: ${{ env.GO_VERSION }}

- name: "Ensure docs are up-to-date"
if: ${{ github.event_name == 'pull_request' }}
run: ./scripts/check-docs.sh

- name: Lint
run: make lint

- name: Test
run: make test
21 changes: 21 additions & 0 deletions scripts/check-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# This script is used to ensure for PRs the docs are up-to-date via the CI pipeline
# Usage: ./check-docs.sh
set -eo pipefail

ROOT_DIR=$(git rev-parse --show-toplevel)

before_hash=$(find docs -type f -exec sha256sum {} \; | sort | sha256sum | awk '{print $1}')

# re-generate the docs
go run $ROOT_DIR/scripts/generate.go

after_hash=$(find docs -type f -exec sha256sum {} \; | sort | sha256sum | awk '{print $1}')

if [[ "$before_hash" == "$after_hash" ]]; then
echo "Docs are up-to-date"
else
echo "Changes detected. Docs are *not* up-to-date."
exit 1
fi