Problem matchers do not work on colored output
Describe the bug Color codes appear to affect regex matching of problem matchers
To Reproduce Steps to reproduce the behavior:
- Create a problem matcher that matches plaintext, e.g.
"regexp": "Hello world" - Run an action that produces color output, for example:
bash -c "printf '\e[31mHello\e[0m world!\n'" - Observe that no match appears in the actions output or inline on a PR "files" tab.
As a more real-life example, I have created a minimal reproduction with colored output and missing the expected annotations: https://github.com/ian-h-chamberlain/actions-color-repro/actions/runs/3777593125
However, when I updated the workflow to disable color output, annotations appear as expected: https://github.com/ian-h-chamberlain/actions-color-repro/pull/1 https://github.com/ian-h-chamberlain/actions-color-repro/actions/runs/3777594485
Expected behavior Most (all?) are written against plain (un-colored) text, but it would be nice to have colorized output in the action logs while still supporting colored output.
This document indicates that color codes should be stripped before applying matchers.
Runner Version and Platform
Version of your runner? Current runner version: '2.299.1'
OS of the machine running the runner? ubuntu-latest
What's not working?
See the "expected behavior" above.
Other notes
I believe this logic is incomplete for stripping ANSI color codes: https://github.com/actions/runner/blob/a1244d22692e44d7e1fe36e6eee7773f065e4ed3/src/Runner.Worker/Handlers/OutputManager.cs#L19 https://github.com/actions/runner/blob/a1244d22692e44d7e1fe36e6eee7773f065e4ed3/src/Runner.Worker/Handlers/OutputManager.cs#L100
Here is a sample logs from a more realistic run which I believe show a wider range of ANSI control codes that might be encountered by tools that use color: 6_Run clippy linting.txt