Skip to content

Support the NO_COLOR environment variable out of the box #1017

@escarls

Description

@escarls

I'm setting up Renovate to run as a github action in a Github Enterprise environment.
And as it's my first time doing it this way, I've set the LOG_LEVEL variable to debug to get all the issues I have to solve.
With that setup, the logs got pretty anoying to read due to the ansi color codes used.

So I did some googling and it seems the industry standard is to set the NO_COLOR environment variable to true or 1.
I did try that, but nothing changed.

So I tested with renovate cli locally and all color was gone from the stdin when I set this environment variable.

Digging a bit further, I found the "env-regex" input.
Following the example from the README.md, I found I had to take a copy of the default env-regex setting:
^(?:RENOVATE_\\w+|LOG_LEVEL|GITHUB_COM_TOKEN|NODE_OPTIONS|(?:HTTPS?|NO)_PROXY|(?:https?|no)_proxy)$
and add my "NO_COLOR" to that.
^(?:RENOVATE_\\w+|LOG_LEVEL|GITHUB_COM_TOKEN|NODE_OPTIONS|NO_COLOR|(?:HTTPS?|NO)_PROXY|(?:https?|no)_proxy)$

This worked like a charm, and now I could see the logs with no color coding.

This got me thinking that since "NO_COLOR" seems to be some kind of industry standard for this and renovate cli supports it, it would probably be nice for others to have this out of the box.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Priority

    None yet

    Datasource

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions