-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Syntax content is dedented and stripped in GitHub Actions #3500
Comments
This isn't a Rich issue. You might want to raise it with Github? |
Hi @willmcgugan, Thanks for your time and the great work! |
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 ") 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:
Tip
When
force_terminal
is not set forConsole
, the problem is solved, but then of course you don't get any syntax highlighting!Note
The panel is just there to better illustrate the issue; the results are the same without it.
The text was updated successfully, but these errors were encountered: