refactor code #13
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 go generate no changes | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
go-generate-check: | |
name: Check if go generate changes any files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: stable | |
- name: Run go generate | |
run: go generate ./... | |
- name: Check for uncommitted changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Error: Files were changed after running 'go generate'" | |
git status | |
exit 1 | |
else | |
echo "Success: No changes detected" | |
fi |