Skip to content

Commit 9aa3f4f

Browse files
committed
CI: Allow for generated code in PRs
Generated code must now be included in PRs. This is helpful during review, as it provides the reviewer with the ability to see the result of a change. This is also necessary after hemtjanst/zyaml@78cfbb9 as it'll now raise PRs instead, which will include the generated code.
1 parent cf26bc8 commit 9aa3f4f

File tree

2 files changed

+8
-58
lines changed

2 files changed

+8
-58
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@ on:
44
paths-ignore:
55
- 'README.md'
66
- 'LICENSE'
7-
- 'cluster/**'
8-
- 'zdo/**'
97
branches:
108
- master
119
push:
1210
paths-ignore:
1311
- 'README.md'
1412
- 'LICENSE'
15-
- 'cluster/**'
16-
- 'zdo/**'
1713
branches:
1814
- master
1915

@@ -36,6 +32,14 @@ jobs:
3632
working-directory: ./zcl
3733
run: |
3834
go run hemtjan.st/zcl/cmd/zclgen -definition-path ../zyaml
35+
if test -n "$(git status -s)"; then
36+
echo "Repository is in dirty state!"
37+
echo " Update your copy of zyaml to latest master"
38+
echo " Regenerate using cmd/zclgen"
39+
echo "Changed files:"
40+
git status -s
41+
exit 1
42+
fi
3943
- name: Build updated ZCL
4044
working-directory: ./zcl
4145
run: |
@@ -44,41 +48,3 @@ jobs:
4448
working-directory: ./zcl
4549
run: |
4650
go test -v hemtjan.st/zcl/...
47-
update:
48-
name: Push updated ZCL
49-
if: github.ref == 'refs/heads/master'
50-
needs: generate_and_test
51-
runs-on: ubuntu-latest
52-
steps:
53-
- uses: actions/checkout@v2
54-
with:
55-
path: zcl
56-
ssh-key: ${{ secrets.BOT_SSH_KEY }}
57-
- uses: actions/checkout@v2
58-
with:
59-
repository: hemtjanst/zyaml
60-
path: zyaml
61-
- uses: actions/setup-go@v2-beta
62-
with:
63-
go-version: '1.14'
64-
- name: Generate ZCL
65-
working-directory: ./zcl
66-
run: |
67-
go run hemtjan.st/zcl/cmd/zclgen -definition-path ../zyaml
68-
go build hemtjan.st/zcl/...
69-
go mod tidy
70-
- name: Commit
71-
working-directory: ./zcl
72-
run: |
73-
if test -n "$(git status -s)"; then
74-
git config user.name "Hemtjanst Bot"
75-
git config user.email "[email protected]"
76-
git add .
77-
git commit -m "Regenerated library at ${GITHUB_SHA}"
78-
else
79-
echo "No changes to generated code"
80-
fi
81-
- name: Push
82-
working-directory: ./zcl
83-
run: |
84-
git push

.github/workflows/generated.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)