From 436f42c00c77faedc2cff06949006f527fba6c19 Mon Sep 17 00:00:00 2001 From: didericis Date: Sat, 6 Jun 2026 00:40:05 -0400 Subject: [PATCH] fix(ci): fix pylint/pyright output capture and parsing - 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 --- .gitea/workflows/update-badges.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/update-badges.yml b/.gitea/workflows/update-badges.yml index 41657a6..620197a 100644 --- a/.gitea/workflows/update-badges.yml +++ b/.gitea/workflows/update-badges.yml @@ -31,31 +31,17 @@ jobs: - name: Run pylint and extract score id: pylint - continue-on-error: true run: | - # Run pylint and capture the score - PYLINT_OUTPUT=$(python -m pylint bot_bottle/ 2>&1 | tail -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 + PYLINT_OUTPUT=$(python -m pylint bot_bottle/ 2>&1) || true + SCORE=$(echo "$PYLINT_OUTPUT" | grep -oP '(?<=rated at )\d+\.\d+/10' | head -1) echo "score=$SCORE" >> $GITHUB_OUTPUT echo "Pylint score: $SCORE" - name: Run pyright and check errors id: pyright - continue-on-error: true run: | - # Run pyright and check for errors - PYRIGHT_OUTPUT=$(python -m pyright 2>&1 | tail -1) - echo "Output: $PYRIGHT_OUTPUT" - # Extract error count - ERRORS=$(echo "$PYRIGHT_OUTPUT" | grep -oP '^\d+' | head -1) - if [ -z "$ERRORS" ]; then - ERRORS="0" - fi + PYRIGHT_OUTPUT=$(python -m pyright 2>&1) || true + ERRORS=$(echo "$PYRIGHT_OUTPUT" | grep -oP '\d+(?= error)' | head -1) echo "errors=$ERRORS" >> $GITHUB_OUTPUT echo "Pyright errors: $ERRORS"