Skip to content

Commit 2fd651c

Browse files
committed
Introduce PR workflow to check modules are synced
1 parent ab74cb9 commit 2fd651c

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Check sync-module-dependencies
2+
permissions:
3+
contents: read
4+
on: pull_request
5+
6+
jobs:
7+
check:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: '1.25.x'
20+
21+
- name: Cache Go build and modules
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.cache/go-build
26+
~/go/pkg/mod
27+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
restore-keys: |
29+
${{ runner.os }}-go-
30+
31+
- name: Run sync-module-dependencies
32+
run: |
33+
make sync-module-dependencies
34+
35+
- name: Check for go.mod changes
36+
run: |
37+
# List changed go.mod files (added/modified/deleted)
38+
CHANGED=$(git status --porcelain | awk '{print $2}' | grep -E '(^|/)go\.mod$' || true)
39+
40+
if [ -n "$CHANGED" ]; then
41+
echo "::error::go.mod files are out of sync with sync-module-dependencies."
42+
echo "The following go.mod files changed:"
43+
echo "$CHANGED"
44+
echo
45+
echo "Diff:"
46+
git --no-pager diff -- $CHANGED || true
47+
echo
48+
echo "To fix locally, run:"
49+
echo " (cd tools/sync-module-dependencies && go generate .)"
50+
exit 1
51+
fi

0 commit comments

Comments
 (0)