[red-knot] mypy_primer: strip ANSI codes (#16604)

## Summary

Strip ANSI codes in the mypy_primer diff before uploading.

## Test Plan

Successful run here: https://github.com/astral-sh/ruff/pull/16601
This commit is contained in:
David Peter 2025-03-10 17:32:01 +01:00 committed by GitHub
parent a73548d0ca
commit ec9ee93d68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View file

@ -10,6 +10,7 @@ on:
- "crates/ruff_python_ast"
- "crates/ruff_python_parser"
- ".github/workflows/mypy_primer.yaml"
- ".github/workflows/mypy_primer_comment.yaml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
@ -67,7 +68,7 @@ jobs:
--new "$GITHUB_SHA" \
--project-selector '/(mypy_primer|black|pyp|git-revise|zipp|arrow)$' \
--output concise \
--debug | tee mypy_primer.diff
--debug | tee /dev/stdout | sed -e 's/\x1b\[[0-9;]*m//g' > mypy_primer.diff
) || [ $? -eq 1 ]
echo ${{ github.event.number }} > pr-number

View file

@ -62,9 +62,13 @@ jobs:
echo '<!-- generated-comment mypy_primer -->' >> comment.txt
echo '## `mypy_primer` results' >> comment.txt
if [ -s "pr/mypy_primer_diff/mypy_primer.diff" ]; then
echo '```diff' >> comment.txt
cat pr/mypy_primer_diff/mypy_primer.diff >> comment.txt
echo '```' >> comment.txt
else
echo 'No ecosystem changes detected ✅' >> comment.txt
fi
echo 'comment<<EOF' >> "$GITHUB_OUTPUT"
cat comment.txt >> "$GITHUB_OUTPUT"