From bb77c561315544f013f7c3cedadc378ff40c62af Mon Sep 17 00:00:00 2001 From: jcardozo-eth <131674798+jcardozo-eth@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:29:15 +0200 Subject: [PATCH] ci(github): strip ANSI colour codes from the environment diff comment nix store diff-closures colours the size delta even when stdout is not a TTY, so the colour escape codes leaked into the PR comment and rendered as raw control codes (e.g. ^[[31;1m93.9 KiB^[[0m). Pipe the diff through sed to strip the SGR codes before it reaches the comment body. --- .github/workflows/environment-diff.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/environment-diff.yml b/.github/workflows/environment-diff.yml index e68042e..58c47fe 100644 --- a/.github/workflows/environment-diff.yml +++ b/.github/workflows/environment-diff.yml @@ -60,7 +60,11 @@ jobs: # Empty file: the closures are identical (no effective change). : > diff.txt else - nix store diff-closures ./result-base ./result-head > diff.txt + # Strip ANSI colour codes: diff-closures colours the size delta + # even when stdout is not a TTY, and the escape codes would + # render as raw control codes inside the Markdown comment. + nix store diff-closures ./result-base ./result-head \ + | sed -E 's/\x1b\[[0-9;]*m//g' > diff.txt fi - name: Upsert the PR comment