Skip to content

Commit 8638138

Browse files
committed
ci(packages): fix the path filter reporting "not changed" on SIGPIPE
`printf | grep -q` under pipefail fails when grep exits on the first match and printf takes SIGPIPE, so the first run marked every package unchanged and the gate passed with nothing tested. Match with a here-string instead, and print a count rather than every changed path. Signed-off-by: Richard Abrich <richard.abrich@mldsai.com>
1 parent b62cb04 commit 8638138

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎.github/workflows/packages.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ jobs:
6666
;;
6767
esac
6868
changed="$(git diff --name-only "$base" HEAD)"
69-
printf '%s\n' "$changed" | sed 's/^/changed: /'
70-
hit() { if printf '%s\n' "$changed" | grep -Eq "$1"; then echo true; else echo false; fi; }
69+
echo "$(grep -c . <<<"$changed" || true) changed paths"
70+
# A here-string, not a pipe: with pipefail, `printf | grep -q` can
71+
# fail on SIGPIPE and silently report "not changed".
72+
hit() { if grep -Eq "$1" <<<"$changed"; then echo true; else echo false; fi; }
7173
wf='^\.github/workflows/packages\.yml$'
7274
flow="$(hit "^packages/flow/|$wf")"
7375
types="$(hit "^packages/types/|$wf")"

0 commit comments

Comments
 (0)