Skip to content

Commit e4d5c27

Browse files
committed
Copy tidy-up-job from app-autoscaler-release;
1 parent 147f052 commit e4d5c27

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/tidy_go_mod.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Check if go.mod is tidy
2+
on:
3+
pull_request:
4+
5+
concurrency:
6+
group: "${{ github.workflow }}/${{ github.ref }}"
7+
cancel-in-progress: true
8+
9+
jobs:
10+
check-tidy-go-mod:
11+
name: ensure that go mod tidy has run
12+
runs-on: ubuntu-latest
13+
container:
14+
image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Trust my checkout
19+
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
20+
21+
- name: run go mod tidy on all .mod's
22+
shell: bash
23+
run: |
24+
#! /usr/bin/env bash
25+
set -eu -o pipefail
26+
27+
make generate-fakes
28+
make generate-openapi-generated-clients-and-servers
29+
make go-mod-tidy
30+
31+
- name: Check if there is any change
32+
id: get_changes
33+
run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT
34+
35+
- name: Process changes
36+
if: steps.get_changes.outputs.changed != 0
37+
run: |
38+
echo "::error::go.mod is not tidy, run make go-mod-tidy to tidy"
39+
exit 1

0 commit comments

Comments
 (0)