claude-code-action icon indicating copy to clipboard operation
claude-code-action copied to clipboard

Branch link in finished comment broken on GitHub Enterprise Server (regex hardcodes github.com)

Open ManoharPaturi opened this issue 2 months ago • 5 comments

what happens

on github enterprise server the finished comment shows the branch as plain text with no link.

why

the owner/repo extraction in the finished-comment logic hardcodes github.com in its regex:

const repoMatch = jobUrl.match(/github\.com\/([^\/]+)\/([^\/]+)\//);

on ghes the job url is https://github.mycompany.com/owner/repo/... so the match fails, branchUrl stays undefined, and the header falls back to plain text.

expected

the regex uses the actual server url (the job url's own origin) so ghes installs get a clickable branch link too.

env: main a4f54ef

ManoharPaturi avatar Sep 18 '26 09:09 ManoharPaturi

I’d like to work on this issue. I’ll update the finished-comment branch URL handling to derive the GitHub host from the job URL instead of hardcoding github.com, and add/update tests to cover GitHub Enterprise Server.

AbarnaaSree avatar Sep 18 '26 17:09 AbarnaaSree

@AbarnaaSree hey, thanks for picking this up! small world though, i already have an open PR for the fix (#1844). would genuinely love a second pair of eyes on it, especially the GHES test cases since i could only test the regex side. take a look at the PR and drop a comment there if you want to work on it together, we can split the tests

ManoharPaturi avatar Sep 18 '26 18:09 ManoharPaturi

Thanks! I’ll take a look at #1844 and focus specifically on the GHES test coverage so I don’t duplicate the implementation.

I’ll check the existing finished-comment tests and add coverage for deriving the branch URL from a non-github.com job URL, along with any relevant edge cases that are currently missing.

AbarnaaSree avatar Sep 19 '26 08:09 AbarnaaSree

sounds good! worth adding a test for hostnames containing github.com as a substring (ourgithub.com etc), origin-derivation covers it but it should be pinned. drop any gaps or diffs you find on the (#1844 ) thread and i'll fold them in

ManoharPaturi avatar Sep 19 '26 10:09 ManoharPaturi

Hi maintainers,

I'd like to investigate this issue and contribute a fix.

The current URL-matching logic appears to assume that the host is always github.com, which prevents branch links from being generated correctly on GitHub Enterprise Server.

I'd like to investigate using the actual URL structure rather than relying on a hard-coded hostname, and add regression tests for both GitHub.com and a GitHub Enterprise-style hostname.

Is there an existing helper or repository convention for constructing GitHub URLs that I should use for this change?

I'll verify the expected behavior before opening a focused PR.

Thanks!

Udit-Agarwal20 avatar Oct 16 '26 10:10 Udit-Agarwal20