fix(ci): fix pylint/pyright output capture and parsing
test / unit (push) Successful in 38s
test / integration (push) Successful in 52s

- Capture full output with || true instead of pipefail-sensitive | tail -1
- Use lookbehind for pylint score to avoid matching "previous run" value
- Use lookahead for pyright error count to search full output not just last line
- Remove hardcoded fallback values that masked parse failures

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 00:40:05 -04:00
parent 881869352d
commit 436f42c00c
+4 -18
View File
@@ -31,31 +31,17 @@ jobs:
- name: Run pylint and extract score - name: Run pylint and extract score
id: pylint id: pylint
continue-on-error: true
run: | run: |
# Run pylint and capture the score PYLINT_OUTPUT=$(python -m pylint bot_bottle/ 2>&1) || true
PYLINT_OUTPUT=$(python -m pylint bot_bottle/ 2>&1 | tail -1) SCORE=$(echo "$PYLINT_OUTPUT" | grep -oP '(?<=rated at )\d+\.\d+/10' | head -1)
echo "Output: $PYLINT_OUTPUT"
# Extract score (e.g., "9.92/10")
SCORE=$(echo "$PYLINT_OUTPUT" | grep -oP '\d+\.\d+/10' | head -1)
if [ -z "$SCORE" ]; then
SCORE="9.92/10"
fi
echo "score=$SCORE" >> $GITHUB_OUTPUT echo "score=$SCORE" >> $GITHUB_OUTPUT
echo "Pylint score: $SCORE" echo "Pylint score: $SCORE"
- name: Run pyright and check errors - name: Run pyright and check errors
id: pyright id: pyright
continue-on-error: true
run: | run: |
# Run pyright and check for errors PYRIGHT_OUTPUT=$(python -m pyright 2>&1) || true
PYRIGHT_OUTPUT=$(python -m pyright 2>&1 | tail -1) ERRORS=$(echo "$PYRIGHT_OUTPUT" | grep -oP '\d+(?= error)' | head -1)
echo "Output: $PYRIGHT_OUTPUT"
# Extract error count
ERRORS=$(echo "$PYRIGHT_OUTPUT" | grep -oP '^\d+' | head -1)
if [ -z "$ERRORS" ]; then
ERRORS="0"
fi
echo "errors=$ERRORS" >> $GITHUB_OUTPUT echo "errors=$ERRORS" >> $GITHUB_OUTPUT
echo "Pyright errors: $ERRORS" echo "Pyright errors: $ERRORS"