Skip to content

Switch to ansi_up for ansi rendering in actions #25401

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

Merged
merged 7 commits into from
Jun 22, 2023

Conversation

silverwind
Copy link
Member

Fixes: #24777

Screenshot 2023-06-20 at 23 08 33 Screenshot 2023-06-20 at 23 08 22 Screenshot 2023-06-20 at 23 08 45

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 20, 2023
@silverwind silverwind added type/enhancement An improvement of existing functionality topic/gitea-actions related to the actions of Gitea labels Jun 20, 2023
Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But apart from that LGTM

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 20, 2023
@silverwind
Copy link
Member Author

@wxiaoguang can you help me update these tests? They talk about some bugs in AnsiToHTML but those seem not present in ansi_up from cursory testing.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jun 20, 2023
@silverwind
Copy link
Member Author

silverwind commented Jun 20, 2023

Tests are now passing, but I'm not 100% certain the results are as expected. There are a number of style="color:rgb(255,255,255)" outputs, but actions log itself does not have this white color for uncolored text which seems odd.

@silverwind silverwind marked this pull request as draft June 21, 2023 06:26
@pull-request-size pull-request-size bot added size/L and removed size/M labels Jun 21, 2023
@silverwind silverwind marked this pull request as ready for review June 21, 2023 19:24
@silverwind
Copy link
Member Author

silverwind commented Jun 21, 2023

Ready again. I've moved the function and tests to separate files and restored all previous tests. The only test modification I did was to replace the previous ansi_to_html tests with test cases that call the function.

The problem with the style="color:rgb(255,255,255)" was that a ansi_up instance is stateful so when one test opened and not closed the color tag, it remembered that for future invocations. I removed this issue now by creating a fresh instance on every function call.

The seemingly odd AnsiUp.default || AnsiUp seems necessary so that the module correctly imports in both vitest and the browser, which I think is an issue related to their legacy AMD wrapper that the module features.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 22, 2023
@techknowlogick techknowlogick added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 22, 2023
@techknowlogick techknowlogick enabled auto-merge (squash) June 22, 2023 02:00
@techknowlogick techknowlogick merged commit 93cd579 into go-gitea:main Jun 22, 2023
@GiteaBot GiteaBot added this to the 1.21.0 milestone Jun 22, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 22, 2023
@silverwind silverwind deleted the consolecolors branch June 22, 2023 20:34
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/gitea-actions related to the actions of Gitea type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Actions] Support 256 colors
5 participants