Skip to content
Prev Previous commit
Next Next commit
rewrite bash script
  • Loading branch information
donbarbos committed Oct 22, 2025
commit d01bc96aa399cfc949cbedc3902093bc3bf38176
23 changes: 15 additions & 8 deletions .github/workflows/stubsabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,22 @@ jobs:
shell: bash
run: |
# Parse stubsabot.py output to find stubs that should be tested.
set -o pipefail
exec 5>&1
STUBS=$(script -qfc "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} python scripts/stubsabot.py --action-level nothing" /dev/null \
| tee >(cat - >&5) \
| sed -r "s/\x1B\[[0-9;]*[mK]//g" \
| grep 'should be tested by stubsabot' \
| awk '{print $1}' \
| xargs)
exit_code=$?
EXIT_FILE=$(mktemp)
STUBS_FILE=$(mktemp)
script -q /dev/null -c '
python scripts/stubsabot.py --action-level nothing
echo $? > '"$EXIT_FILE"'
' 2>&1 | while IFS= read -r line; do
echo "$line" >&5
clean=$(echo "$line" | sed -r "s/\x1B\[[0-9;]*[mK]//g")
if [[ $clean == *"should be tested by stubsabot"* ]]; then
echo "${clean%% *}" >> "$STUBS_FILE"
fi
done
exit_code=$(cat "$EXIT_FILE")
STUBS=$(xargs < "$STUBS_FILE")
rm "$EXIT_FILE" "$STUBS_FILE"
echo "STUBS=$STUBS" >> $GITHUB_OUTPUT
exit $exit_code

Expand Down
Loading