Skip to content

Commit

Permalink
CI: Allow for generated code in PRs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
daenney committed Apr 12, 2020
1 parent cf26bc8 commit 9aa3f4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 58 deletions.
50 changes: 8 additions & 42 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ on:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'cluster/**'
- 'zdo/**'
branches:
- master
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'cluster/**'
- 'zdo/**'
branches:
- master

Expand All @@ -36,6 +32,14 @@ jobs:
working-directory: ./zcl
run: |
go run hemtjan.st/zcl/cmd/zclgen -definition-path ../zyaml
if test -n "$(git status -s)"; then
echo "Repository is in dirty state!"
echo " Update your copy of zyaml to latest master"
echo " Regenerate using cmd/zclgen"
echo "Changed files:"
git status -s
exit 1
fi
- name: Build updated ZCL
working-directory: ./zcl
run: |
Expand All @@ -44,41 +48,3 @@ jobs:
working-directory: ./zcl
run: |
go test -v hemtjan.st/zcl/...
update:
name: Push updated ZCL
if: github.ref == 'refs/heads/master'
needs: generate_and_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
path: zcl
ssh-key: ${{ secrets.BOT_SSH_KEY }}
- uses: actions/checkout@v2
with:
repository: hemtjanst/zyaml
path: zyaml
- uses: actions/setup-go@v2-beta
with:
go-version: '1.14'
- name: Generate ZCL
working-directory: ./zcl
run: |
go run hemtjan.st/zcl/cmd/zclgen -definition-path ../zyaml
go build hemtjan.st/zcl/...
go mod tidy
- name: Commit
working-directory: ./zcl
run: |
if test -n "$(git status -s)"; then
git config user.name "Hemtjanst Bot"
git config user.email "[email protected]"
git add .
git commit -m "Regenerated library at ${GITHUB_SHA}"
else
echo "No changes to generated code"
fi
- name: Push
working-directory: ./zcl
run: |
git push
16 changes: 0 additions & 16 deletions .github/workflows/generated.yaml

This file was deleted.

0 comments on commit 9aa3f4f

Please sign in to comment.