I have this GitHub action that runs my PowerShell test scripts. The test scripts outputs "[ERROR]" on an error and "[WARNING]" on a warning.
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.

- 9,878
- 7
- 49
- 66

- 91
- 1
- 4
2 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.

- 1,262,500
- 529
- 4,410
- 5,250
-
Would be neat if this was also possible via github markdown (or highlight.js). Then we could finally copy-paste our long powershell/bash logs and have them color highlighted – Snailedlt Sep 28 '22 at 14:46
-
@Snailedlt Agreed. That does not seem to be supported for now. – VonC Sep 28 '22 at 15:14
-
@VonC How would you use them, except for using escape codes? Echo out "[Debug] hello world", gives magenta color for example.. Warning = yellow and so on. Tried to find any documentation on this but failed.. – Baked Inhalf Oct 28 '22 at 11:41
-
@BakedInhalf I don't have any more information on those colors indeed. Maybe [Adrián Mato](https://twitter.com/adrianmg) (who wrote the blog post in 2020) has more on this. – VonC Oct 28 '22 at 14:30
It might be late or not relevant for specific PowerShell or Vstest software but more to help anyone like me searching for an answer on how to make colourized output in GitHub Actions (and eventually ending up here).
The solution is pretty simple - use text wrapped in ANSI colour markup! I found some source examples for typescript and shell scripts. Yes, simple as that - if you can control the output then wrap your text with special markup and that would be it!
P.S.
More info and the most packed guide on ANSI colour output is here: List of ANSI color escape sequences

- 1,800
- 2
- 14
- 30