Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github Actions Output Text Color

I have this GitHub action that runs my PowerShell test scripts. The test scripts outputs "[ERROR]" on an error and "[WARNING]" on a warning. Screenshot of colored GitHub Actions log I am wondering if there is any documentation on other keywords that are highlighted. The GitHub actions are running on 'windows-latest' in a pwsh/PowerShell shell.

like image 235
BrandonMFong Avatar asked Apr 29 '26 19:04

BrandonMFong


1 Answers

The colors are not the result of GitHub Action itself, but of the testing framework used.

See for instance microsoft/vstest issue 2370 "Support Colorized Output in GitHub Actions"

xUnit.net does not attempt any colorization here. Our messages are passed to the VSTest API with just text and a level. All colorization in dotnet test is owned by VSTest.

What you see in a GitHub Action is the result of the tool used by that Action.

As mentioned in "A better logs experience with GitHub Actions" in Sept. 2020:

We want to be more mindful about color usage, which means we also need to acknowledge that people build their own scripts, commands, and tools to output useful information.

That’s why we are increasing the color support, including:

  • ANSI colors
  • 8-bit colors
  • 24-bit colors

This enables richer content and better integration when rendering information coming from third-party sources.

https://github.blog/wp-content/uploads/2020/09/color.png?resize=1024%2C699?w=1024

like image 152
VonC Avatar answered May 01 '26 09:05

VonC