Skip to content

Linkify URLs in Actions workflow logs#36986

Merged
wxiaoguang merged 16 commits into
go-gitea:mainfrom
silverwind:actionlinks
Mar 26, 2026
Merged

Linkify URLs in Actions workflow logs#36986
wxiaoguang merged 16 commits into
go-gitea:mainfrom
silverwind:actionlinks

Conversation

@silverwind
Copy link
Copy Markdown
Member

@silverwind silverwind commented Mar 25, 2026

Detect URLs in Actions log output and render them as clickable links, similar to how GitHub Actions handles this. Pre-existing links from ansi_up's OSC 8 parsing are also kept intact.

Screenshot 2026-03-25 at 23 50 44 Screenshot 2026-03-25 at 23 50 31

Detect URLs in Actions log output and render them as clickable links,
similar to how GitHub Actions handles this. URLs are detected after
ANSI-to-HTML conversion and wrapped in anchor tags that open in a new
tab. Link color uses a new --color-console-link CSS variable that
overrides any ANSI colors and provides sufficient contrast on both
light and dark themes.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 25, 2026
Comment thread web_src/js/utils/url.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds URL detection and “linkification” to the rendered GitHub Actions job log output, so plain URLs in ANSI-rendered log lines become clickable links in the UI.

Changes:

  • Add a linkifyURLs() utility to convert detected http(s)://... substrings into <a> tags while preserving existing ANSI-generated HTML tags.
  • Apply URL linkification to renderAnsi() output so Actions logs automatically render clickable URLs.
  • Add styling for links in Actions logs and introduce a console link theme variable, plus unit tests for the new behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web_src/js/utils/url.ts Introduces URL linkification logic for ANSI-rendered HTML strings.
web_src/js/utils/url.test.ts Adds unit tests covering URL linkification cases and HTML-tag-preservation.
web_src/js/render/ansi.ts Runs linkifyURLs() on ANSI-to-HTML rendered output.
web_src/js/render/ansi.test.ts Adds tests verifying URLs become clickable links after ANSI rendering.
web_src/js/components/ActionRunJobView.vue Styles links inside job step logs using a console-themed link color.
web_src/css/themes/theme-gitea-light.css Adds --color-console-link for light theme.
web_src/css/themes/theme-gitea-dark.css Adds --color-console-link for dark theme.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread web_src/js/utils/url.ts Outdated
Comment thread web_src/js/utils/url.ts Outdated
silverwind and others added 3 commits March 26, 2026 00:32
Use simpler URL regex that also matches localhost and dotless hosts.
Use case-insensitive regex test for the fast-path guard.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Not worth the extra code path now that it's a regex test instead of
a simple includes() call.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
The html helper was doing no escaping since both values were htmlRaw.
Use direct string concatenation instead for less overhead.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@silverwind silverwind added type/feature Completely new functionality. Can only be merged if feature freeze is not active. topic/gitea-actions related to the actions of Gitea labels Mar 25, 2026
Comment thread web_src/js/utils/url.ts Outdated
silverwind and others added 4 commits March 26, 2026 00:47
Signed-off-by: silverwind <me@silverwind.io>
Track whether we are inside an existing <a> tag and skip URL
linkification there to prevent invalid nested anchor elements.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Modern browsers imply noopener for target="_blank" and the rest of
the codebase does not use it.

Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Comment thread web_src/js/utils/url.ts Outdated
@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 Mar 26, 2026
silverwind and others added 3 commits March 26, 2026 07:29
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
Comment thread web_src/js/utils/url.test.ts Outdated
silverwind and others added 2 commits March 26, 2026 07:55
Signed-off-by: silverwind <me@silverwind.io>
Co-Authored-By: Claude (claude-opus-4-6) <noreply@anthropic.com>
@silverwind silverwind added type/enhancement An improvement of existing functionality and removed type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Mar 26, 2026
@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 Mar 26, 2026
@wxiaoguang wxiaoguang enabled auto-merge (squash) March 26, 2026 09:47
@wxiaoguang wxiaoguang merged commit 9583e1a into go-gitea:main Mar 26, 2026
26 checks passed
@wxiaoguang wxiaoguang deleted the actionlinks branch March 26, 2026 09:48
@GiteaBot GiteaBot added this to the 1.26.0 milestone Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

5 participants