Skip to content

Commit

Permalink
💡Use NO_COLOR to override FORCE_COLOR @ pip
Browse files Browse the repository at this point in the history
Currently, the underlying use of Rich in pip causes this library
to treat any presence of the `FORCE_COLOR` env var as a sign it's
running in a terminal, even if it's empty.

Additionally, GitHub Actions workflows don't have a syntax to unset
a globally set environment variable. This means it'll remain in the
environment and we can only unset it on the Bash script level.

Hopefully, `NO_COLOR` will just work.

Ref: https://no-color.org
  • Loading branch information
webknjaz committed Nov 20, 2023
1 parent d1d9f6e commit ef5664b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ jobs:
- name: Determine pre-compiled compatible wheel
env:
# NOTE: When `pip` is forced to colorize output piped into `jq`,
# NOTE: the latter can't parse it. So we're disabling it here to
# NOTE: override the value set in the workflow globally.
FORCE_COLOR: ~
# NOTE: the latter can't parse it. So we're overriding the color
# NOTE: preference here via https://no-color.org.
# NOTE: Setting `FORCE_COLOR` to any value (including 0, an empty
# NOTE: string, or a "YAML null" `~`) doesn't have any effect and
# NOTE: `pip` (through its verndored copy of `rich`) treats the presence
# NOTE: of the variable as "force-color" regardless.
NO_COLOR: 1
id: wheel-file
run: >
echo -n path= | tee -a "${GITHUB_OUTPUT}"
Expand Down

0 comments on commit ef5664b

Please sign in to comment.