feat: Remove ANSI control chars from GitHub step Summary and PR comment#1312
Conversation
update branch
more tests formatting
fix formatting
|
Hi @tgummerer, do you by any chance have time to take a look at this PR? |
|
Hi all This one contains some real QoL improvements |
| import * as core from '@actions/core'; | ||
| import { Config } from '../config'; | ||
|
|
||
| function trimOutput( |
There was a problem hiding this comment.
Why trimOutput here and in pr.ts? Looks like one of these should be removed they're doing the same thing.
There was a problem hiding this comment.
Basically, they do the same thing, yes, they trim the input string to the desired format, but for pr and summary, the formats are different.
Summary has a limit on the maximum message size in bytes, and pr has a limit on the maximum length in characters.
Maybe I should use the different names to avoid confusion?
There was a problem hiding this comment.
done, ready for re-review
extracted ansi regexp
tgummerer
left a comment
There was a problem hiding this comment.
Sorry about dropping the ball on this, and taking so long to review it. This PR looks good to me now, I'm gonna get it merged.
|
This PR has been shipped in release v6.6.0. |
This PR introduces striping of ANSI symbols for GitHub step Summary and improves the current one for PR comments.
To resolve #1248
This is similar to #1231, but uses a slightly different approach. Instead of converting ANSI symbols to html tags (using the
ansi-to-htmlpackage), which results in\x1b[30mblackbecoming<span style="color:#000">black</span>, we simply remove them using a regular expression, which results in\x1b[30mblackbecoming justblack.The reason is that neither the Summary nor the PR comment is able to actually render the
<span style="color:#000">block with color. However, all these html tags consume limits for PR comment length and Summary size.Fixes #1387