Closed AAriam closed 2 months ago
This isn't a Rich issue. You might want to raise it with Github?
Hi @willmcgugan,
Thanks for your time and the great work! Do you maybe have an idea what exactly is happening there?
If I were to guess. It looks like it interpreting the output as HTML, which will collapse spaces.
So, basically what's happening is that GitHub Actions ignores any whitespace-only segment that is enclosed by two ANSI sequences, or one ANSI and the end of line:
Sample workflow to reproduce:
on: workflow_dispatch
jobs:
test-ansi:
runs-on: ubuntu-latest
steps:
- shell: python
run: |
print("The following must print a red line but it does not:")
print("\033[48;2;255;0;0m ")
print("It only prints the line if it has a non-space character:")
print("\033[48;2;255;0;0m X ")
print("Leading spaces are normally respected:")
print(" \033[48;2;255;0;0m X ")
print("But not when they are enclosed by ANSI code:")
print("\033[48;2;255;0;0m \033[0m X ")
print(
"Basically, all segments containing only spaces are ignored "
"when enclosed between two ANSI sequences, "
"or one ANSI sequence and the end of the line:"
)
print("\033[48;2;255;0;0m \033[48;2;0;255;0m \033[48;2;0;0;255m ")
Output:
Thanks for the reply @willmcgugan; I opened a ticket with GitHub.
I hope we solved your problem.
If you like using Rich, you might also enjoy Textual
Nice sleuthing. Do you have a link to the issue? I’d like to follow it.
I opened an issue at https://support.github.com/contact/bug-report, the issue is at https://support.github.com/ticket/3019506, but I think its only accessible by me?
Describe the bug
Works fine in a terminal:
But not on GitHub Actions: