Problem matchers do not work on colored output
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 1.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 24
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading src/Runner.Worker/Handlers/OutputManager.cs at the referenced lines and compare its ANSI stripping logic with docs/adrs/0276-problem-matchers.md. Reproduce the issue with the provided bash command and sample logs; done means the plaintext matcher finds “Hello world” in colored output while the colorized log remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- ci-cd, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100