File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Verify
2+
3+ on :
4+ pull_request :
5+ workflow_dispatch :
6+
7+ jobs :
8+ verify :
9+ name : Verify Codegen
10+
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Clone the code
14+ uses : actions/checkout@v4
15+
16+ - name : Setup Go
17+ uses : actions/setup-go@v5
18+ with :
19+ go-version-file : go.mod
20+
21+ - name : Run Codegen
22+ shell : bash
23+ env :
24+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25+ run : make update-codegen
26+
27+ - name : Verify
28+ shell : bash
29+ run : |
30+ # URL encode function for GitHub Actions annotations
31+ # From: https://backreference.org/2009/12/23/how-to-match-newlines-in-sed/
32+ function urlencode() {
33+ sed ':begin;$!N;s/\n/%0A/;tbegin'
34+ }
35+
36+ if [[ -z "$(git status --porcelain)" ]]; then
37+ echo "${{ github.repository }} up to date."
38+ else
39+ echo "Found diffs in: $(git diff-index --name-only HEAD --)"
40+ for x in $(git diff-index --name-only HEAD --); do
41+ echo "::error file=$x::Please run 'make update-codegen'.%0A$(git diff $x | urlencode)"
42+ done
43+ echo "Generated code is out of date. Please run 'make update-codegen' and commit the changes."
44+ exit 1
45+ fi
Original file line number Diff line number Diff line change @@ -239,6 +239,9 @@ undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.
239239create-kind-cluster :
240240 ./hack/create-kind-cluster.sh
241241
242+ .PHONY : update-codegen
243+ update-codegen : generate manifests gen-mocks
244+
242245# #@ Dependencies
243246
244247# # Location to install dependencies to
You can’t perform that action at this time.
0 commit comments