Skip to content

Commit 921b669

Browse files
committed
Display type error annotations.
1 parent 833909b commit 921b669

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/all_tests.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,30 @@ jobs:
1414
set -euo pipefail
1515
python3 -m pip install mypy
1616
mypy --check-untyped-defs src/__main__.py src/downloader > mypy_output.txt 2>&1 || true
17+
18+
# Count errors
1719
TYPE_ERRORS=$(grep -c "error:" mypy_output.txt || echo "0")
18-
cat mypy_output.txt
20+
21+
# Write summary header
1922
echo "**Type Check:** Found $TYPE_ERRORS type errors" >> $GITHUB_STEP_SUMMARY
2023
24+
# Add error list with links
25+
if [ "$TYPE_ERRORS" -gt 0 ]; then
26+
echo "" >> $GITHUB_STEP_SUMMARY
27+
while IFS= read -r line; do
28+
if [[ $line =~ ^([^:]+):([0-9]+):[[:space:]]error:[[:space:]](.+)$ ]]; then
29+
file="${BASH_REMATCH[1]}"
30+
line_num="${BASH_REMATCH[2]}"
31+
message="${BASH_REMATCH[3]}"
32+
url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/blob/$GITHUB_SHA/$file#L$line_num"
33+
echo "- [\`$file:$line_num\`]($url): **\`$message\`**" >> $GITHUB_STEP_SUMMARY
34+
fi
35+
done < mypy_output.txt
36+
fi
37+
38+
# Display full output in logs
39+
cat mypy_output.txt
40+
2141
unit-tests:
2242
runs-on: ubuntu-latest
2343
steps:

0 commit comments

Comments
 (0)