Skip to content

Commit d01bc96

Browse files
committed
rewrite bash script
1 parent 1267aeb commit d01bc96

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.github/workflows/stubsabot.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,22 @@ jobs:
3939
shell: bash
4040
run: |
4141
# Parse stubsabot.py output to find stubs that should be tested.
42-
set -o pipefail
4342
exec 5>&1
44-
STUBS=$(script -qfc "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python scripts/stubsabot.py --action-level nothing" /dev/null \
45-
| tee >(cat - >&5) \
46-
| sed -r "s/\x1B\[[0-9;]*[mK]//g" \
47-
| grep 'should be tested by stubsabot' \
48-
| awk '{print $1}' \
49-
| xargs)
50-
exit_code=$?
43+
EXIT_FILE=$(mktemp)
44+
STUBS_FILE=$(mktemp)
45+
script -q /dev/null -c '
46+
python scripts/stubsabot.py --action-level nothing
47+
echo $? > '"$EXIT_FILE"'
48+
' 2>&1 | while IFS= read -r line; do
49+
echo "$line" >&5
50+
clean=$(echo "$line" | sed -r "s/\x1B\[[0-9;]*[mK]//g")
51+
if [[ $clean == *"should be tested by stubsabot"* ]]; then
52+
echo "${clean%% *}" >> "$STUBS_FILE"
53+
fi
54+
done
55+
exit_code=$(cat "$EXIT_FILE")
56+
STUBS=$(xargs < "$STUBS_FILE")
57+
rm "$EXIT_FILE" "$STUBS_FILE"
5158
echo "STUBS=$STUBS" >> $GITHUB_OUTPUT
5259
exit $exit_code
5360

0 commit comments

Comments
 (0)