Skip to content

Commit 81f5508

Browse files
committed
chore: add CI lint for generated files
This should stop generated files becoming stale and should help generated code be included with its non-generated counterpart. Signed-off-by: crozzy <joseph.crosland@gmail.com>
1 parent 8459090 commit 81f5508

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ jobs:
5151
trap 'echo "::error file=go.mod,title=Tidy Check::Commit would leave go.mod untidy"' ERR
5252
go mod tidy
5353
git diff --exit-code
54+
- name: Go Generate
55+
if: ${{ !cancelled() && steps.checkout.conclusion == 'success' && steps.setupgo.conclusion == 'success' }}
56+
run: | # Only run generation for deterministic data.
57+
trap 'echo "::error Generate Check::Generated files are out of date. Run go generate and commit the changes"' ERR
58+
find . -name .git -prune -o -name testdata -prune -o -name vendor -prune -o -name go.mod -printf '%h\n' |
59+
while read -r dir; do (
60+
cd "$dir"
61+
go generate -run 'stringer|mockgen|sql-formatter' ./...
62+
); done
63+
git diff --exit-code
5464
5565
build-documentation:
5666
name: Build Docs

0 commit comments

Comments
 (0)