Skip to content

Commit d5005b7

Browse files
committed
ci: make path filter more accurate (#2381)
1 parent 0f308f3 commit d5005b7

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/build-windows.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ jobs:
5252
- go.mod
5353
- go.sum
5454
EOF
55-
module=$(grep ^module go.mod | awk '{print $2}')
56-
go list -f '{{ join .Deps "\n" }}' cmd/windows | grep ^$module/ | while read pkg; do
57-
echo "- ${pkg#${module}/}/*" >> $filter
55+
56+
sh hack/go-list.sh cmd/windows | while read f; do
57+
echo "- $f" | tee -a $filter
5858
done
59-
59+
6060
- uses: dorny/paths-filter@v2
6161
id: filter
6262
with:

hack/go-list.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
path=$1
6+
module=$(grep ^module "$(dirname $0)/../go.mod" | awk '{print $2}')
7+
go list -f '{{ join .Deps "\n" }}' -compiled ./$path/... | grep ^$module/ | while read pkg; do
8+
d="${pkg#${module}/}"
9+
go list -f '{{ join .CompiledGoFiles "\n" }}' -compiled ./$d | while read f; do
10+
echo "$d/$f"
11+
done
12+
done

0 commit comments

Comments
 (0)