Skip to content

Commit

Permalink
ci: make path filter more accurate (#2381)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Feb 27, 2023
1 parent 1bc6c81 commit b8ad117
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-windows.yaml
Expand Up @@ -53,11 +53,11 @@ jobs:
- go.mod
- go.sum
EOF
module=$(grep ^module go.mod | awk '{print $2}')
go list -f '{{ join .Deps "\n" }}' cmd/windows | grep ^$module/ | while read pkg; do
echo "- ${pkg#${module}/}/*" >> $filter
sh hack/go-list.sh cmd/windows | while read f; do
echo "- $f" | tee -a $filter
done
- uses: dorny/paths-filter@v2
id: filter
with:
Expand Down
12 changes: 12 additions & 0 deletions hack/go-list.sh
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e

path=$1
module=$(grep ^module "$(dirname $0)/../go.mod" | awk '{print $2}')
go list -f '{{ join .Deps "\n" }}' -compiled ./$path/... | grep ^$module/ | while read pkg; do
d="${pkg#${module}/}"
go list -f '{{ join .CompiledGoFiles "\n" }}' -compiled ./$d | while read f; do
echo "$d/$f"
done
done

0 comments on commit b8ad117

Please sign in to comment.