Skip to content

Commit de1d93d

Browse files
committed
wip
1 parent 22c01b1 commit de1d93d

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

.github/workflows/go.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,21 @@ jobs:
2525
only-new-issues: true
2626
args: --verbose
2727

28-
diff:
28+
mod-diff:
2929
runs-on: ubuntu-latest
3030
steps:
3131
- uses: actions/checkout@v4
3232
- uses: actions/setup-go@v5
3333
with:
3434
go-version-file: 'go.mod'
3535
- run: go mod tidy -diff
36-
- run: go mod download
37-
- run: go mod verify
38-
- run: go generate ./...
3936
- name: Detect uncommitted changes
4037
run: |
4138
changes=$(git status --porcelain)
4239
if [[ -n "$changes" ]]; then
4340
{
4441
echo "## :construction: Uncommitted changes"
42+
echo Run `$ go mod tidy` to update the `go.mod` and `go.sum` files.
4543
echo "\`\`\`console"
4644
echo "\$ git status --porcelain"
4745
echo "$changes"
@@ -56,7 +54,7 @@ jobs:
5654
fi
5755

5856
test:
59-
needs: diff
57+
needs: mod-diff
6058
runs-on: ubuntu-latest
6159
steps:
6260
- uses: actions/checkout@v4
@@ -83,3 +81,33 @@ jobs:
8381
- uses: codecov/codecov-action@v4
8482
with:
8583
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
84+
85+
generate-diff:
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/checkout@v4
89+
- uses: actions/setup-go@v5
90+
with:
91+
go-version-file: 'go.mod'
92+
- run: go mod download
93+
- run: go mod verify
94+
- run: go generate ./...
95+
- name: Detect uncommitted changes
96+
run: |
97+
changes=$(git status --porcelain)
98+
if [[ -n "$changes" ]]; then
99+
{
100+
echo "## :construction: Uncommitted changes"
101+
echo Run `$ go generate ./...` to update the generated files.
102+
echo "\`\`\`console"
103+
echo "\$ git status --porcelain"
104+
echo "$changes"
105+
echo "\`\`\`"
106+
} >> "$GITHUB_STEP_SUMMARY"
107+
108+
echo "::group::Uncommitted changes"
109+
echo "$changes"
110+
echo "::endgroup::"
111+
112+
exit 1
113+
fi

0 commit comments

Comments
 (0)