Skip to content

Commit b8ad117

Browse files
committed
ci: make path filter more accurate (#2381)
1 parent 1bc6c81 commit b8ad117

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
@@ -53,11 +53,11 @@ jobs:
5353
- go.mod
5454
- go.sum
5555
EOF
56-
module=$(grep ^module go.mod | awk '{print $2}')
57-
go list -f '{{ join .Deps "\n" }}' cmd/windows | grep ^$module/ | while read pkg; do
58-
echo "- ${pkg#${module}/}/*" >> $filter
56+
57+
sh hack/go-list.sh cmd/windows | while read f; do
58+
echo "- $f" | tee -a $filter
5959
done
60-
60+
6161
- uses: dorny/paths-filter@v2
6262
id: filter
6363
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)