-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): fail if there are changed files
- Loading branch information
1 parent
0ebce44
commit 442608f
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Check generated files | ||
|
||
on: [push] | ||
|
||
jobs: | ||
gen: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
|
||
- name: Install tools | ||
run: make install | ||
|
||
- name: Generate code | ||
run: | | ||
# We need to start database and run migrations | ||
docker compose up db -d | ||
docker compose run migrate | ||
# Regenerate code | ||
make generate | ||
# Cleanup | ||
docker compose down | ||
- name: Fail if there are changed files | ||
run: | | ||
CHANGED_FILES=$(git diff --name-only) | ||
if [ -n "${CHANGED_FILES}" ]; then | ||
echo "Your generated files are off. Don't forget to run 'make generate'. Files with changes:" | ||
echo "${CHANGED_FILES}" | ||
exit 1 | ||
fi |
This file contains 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