feat(ci): fail if there are changed files #4
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
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 so that sqlboiler can generate code | |
docker compose up db migrate -d | |
# Wait for migrations to pass | |
docker wait go-presentation-generate-code-migrate-1 | |
# Generate 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'" | |
echo "${CHANGED_FILES}" | |
exit 1 | |
fi |