Skip to content

Commit

Permalink
add go generate check
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps committed May 3, 2024
1 parent 8083090 commit f948846
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
VERSION=$(shell git describe --tags)
TALOS_VERSION=$(shell go list -m github.com/siderolabs/talos | awk '{sub(/^v/, "", $$NF); print $$NF}')

generate:
go generate

build:
go build -ldflags="-X 'main.Version=$(VERSION)'"

Expand Down

0 comments on commit f948846

Please sign in to comment.