Spec Drift Check #113
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Spec Drift Check | |
| on: | |
| schedule: | |
| # Daily at 09:15 KST (00:15 UTC) | |
| - cron: "15 0 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: spec-drift-check | |
| cancel-in-progress: false | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Refresh documented specs | |
| run: | | |
| make kis-spec-refresh | |
| make kiwoom-spec-refresh | |
| make ls-spec-refresh | |
| - name: Detect spec drift | |
| id: drift | |
| run: | | |
| set -euo pipefail | |
| TRACKED_FILES=( | |
| pkg/kis/specs/documented_endpoints.json | |
| pkg/kis/specs/documented_specs_generated.go | |
| pkg/kis/specs/documented_endpoint_types_generated.go | |
| pkg/kiwoom/specs/documented_endpoints.json | |
| pkg/kiwoom/specs/documented_specs_generated.go | |
| pkg/kiwoom/specs/documented_endpoint_types_generated.go | |
| pkg/ls/specs/documented_endpoints.json | |
| pkg/ls/specs/documented_specs_generated.go | |
| ) | |
| if git diff --quiet -- "${TRACKED_FILES[@]}"; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "No spec drift detected." >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| mkdir -p artifacts | |
| git status --short -- "${TRACKED_FILES[@]}" > artifacts/spec-status.txt | |
| git diff -- "${TRACKED_FILES[@]}" > artifacts/spec.diff | |
| echo "Spec drift detected in generated/snapshot files." >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload drift artifacts | |
| if: steps.drift.outputs.changed == 'true' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: spec-drift | |
| path: artifacts/ | |
| if-no-files-found: error | |
| - name: Fail on drift | |
| if: steps.drift.outputs.changed == 'true' | |
| run: | | |
| echo "::error::Spec drift detected. Check spec-drift artifact for details." | |
| exit 1 |