Skip to content

Commit 391bc34

Browse files
committed
feat: distinct module and package checks
1 parent dc7f622 commit 391bc34

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/module-check.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ on:
77
pull_request:
88

99
env:
10-
# comma separated list of restricted Go modules
10+
# comma separated list of restricted Go modules/packages
1111
RESTRICTED_MODULES: "cosmossdk.io/x/circuit"
12+
RESTRICTED_PACKAGES: "github.com/cosmos/cosmos-sdk/x/gov, github.com/cosmos/cosmos-sdk/x/group"
1213

1314
jobs:
1415
go-mod-check:
@@ -33,3 +34,17 @@ jobs:
3334
exit 1
3435
fi
3536
done
37+
38+
for PACKAGE in "${RESTRICTED_PACKAGES[@]}"; do
39+
OUTPUT=$(go mod why -vendor "$PACKAGE")
40+
if echo "$OUTPUT" | grep -q "main module does not need to vendor package $PACKAGE"; then
41+
echo "$PACKAGE is not imported ✓"
42+
43+
# if the shortest import path is the E2E suite, is is safe to assume the package is not used in the main module
44+
elif echo "$OUTPUT" | grep -q "github.com/noble-assets/noble/e2e"; then
45+
echo "$PACKAGE is not imported into main Noble module ✓"
46+
else
47+
echo "$PACKAGE is currently restricted as an import in Noble ✘"
48+
exit 1
49+
fi
50+
done

0 commit comments

Comments
 (0)