Skip to content

Commit

Permalink
Validate that generated files are up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Sep 2, 2023
1 parent 0c5d4ad commit 2924c68
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
on: [push]

jobs:
lint:
Expand All @@ -29,6 +22,28 @@ jobs:
- name: Build
run: go build -v ./...

generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Run go generate
run: |
go install golang.org/x/tools/cmd/stringer
go generate ./...
git diff --exit-code || (echo "Generated files have changed. Please run 'go generate' and commit the changes." && exit 1)
- name: Validate
run: |
go mod tidy
git diff --exit-code || (echo "go.mod or go.sum have changed. Please run 'go mod tidy' and commit the changes." && exit 1)
test:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 2924c68

Please sign in to comment.