fix: parse GHE SSH remote URLs with non-standard usernames for fuzzy schedule scattering#44502
Conversation
…schedule scattering Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes GitHub Enterprise (GHE) repository detection during gh aw compile by improving parsing of scp-style SSH remotes that use non-git usernames, so repository context can be derived correctly and fuzzy schedule scattering warnings are avoided in valid GHE repos.
Changes:
- Generalizes
parseGitHubRepoSlugFromURLto accept scp-style SSH remotes with arbitrary usernames (user@host:owner/repo). - Generalizes
extractHostFromRemoteURLto extract the host from scp-style SSH remotes with arbitrary usernames. - Adds/expands tests covering custom-username scp-style SSH remotes (plus GHE HTTPS and SSH-scheme coverage).
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/git.go | Updates Git remote URL parsing to handle scp-style SSH URLs with non-standard usernames for both slug extraction and host extraction. |
| pkg/cli/git_test.go | Adds a test case ensuring host extraction works for custom-username scp-style SSH remotes. |
| pkg/cli/git_helpers_test.go | Adds a focused GHE test suite for slug parsing across SSH (scp and scheme) and HTTPS inputs. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Low
| // SSH scp-like format: [user@]host:path — any username, not just git@ | ||
| if _, afterAt, hasAt := strings.Cut(remoteURL, "@"); hasAt { | ||
| if host, _, found := strings.Cut(afterAt, ":"); found { |
There was a problem hiding this comment.
Addressed in 606b1fa — corrected comment to say "GITHUB_SERVER_URL" to match what the test actually configures.
There was a problem hiding this comment.
The implementation now correctly supports both forms as advertised in the comment. Lines 151-155 handle user@host:path and lines 156-163 handle username-less host:path (with a guard to avoid matching scheme-based URLs). The fix was applied in 606b1fa.
|
@copilot run pr-finisher skill |
|
@copilot please run the Unresolved review feedback to address first:
Run: https://github.com/github/gh-aw/actions/runs/29016118662
|
…/repo) Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
🤖 PR Triage — Run §29020837798
Score breakdown: Impact 23 + Urgency 18 + Quality 14 Rationale: Targeted fix for GHE SSH remote URL parsing — non-
|
Branch is up to date with main (merged in 5c1334f, lock files added in 072d638). All review feedback remains addressed in 606b1fa. Tests pass. Ready for CI re-trigger and merge. |
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
PR Triage - Run 29041860272. Category: bug | Risk: Low | Score: 42/100 | Action: defer (carry-over relabeled). OPEN. Parses GHE SSH remote URLs with non-standard usernames for fuzzy schedule scattering (107+/15-, 3 files). Correct fix but narrow use case. Await CI and review.
|
|
Run: https://github.com/github/gh-aw/actions/runs/29043300437
|
…fix-fuzzy-schedule-scattering Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot please run the
|
🤖 PR Triage — Run §29061171191
GHE SSH URL parsing fix for non-standard usernames. 3 files, 107 additions. Low risk, narrow scope. Ready for batch review.
|
|
@copilot please run the
|
PR finisher completed. All review feedback addressed in 606b1fa. Branch is up to date with main (HEAD 8e7ffd2, base f2bff5d). Local validation passed: fmt ✓, lint ✓ (0 errors), test-unit ✓, recompile ✓. The remaining unresolved review thread is outdated and has been replied to. CI re-trigger required by maintainer (agent pushes don't trigger workflows). PR is ready for merge pending CI verification. |
|
Run: https://github.com/github/gh-aw/actions/runs/29065468296
|
PR finisher complete. No changes needed. All review feedback addressed in 606b1fa. Branch up to date (HEAD 8e7ffd2). Local validation passes (fmt/lint/test-unit/recompile ✓). Recent CI runs successful. The unresolved review thread is outdated and replied to. Ready for merge. |
|
🎉 This pull request is included in a new release. Release: |
gh aw compileincorrectly emits a "Fuzzy schedule scattering without repository context" warning inside valid GHE git repos whose SSH remote uses a non-gitusername — e.g.example@example.ghe.com:example-org/example-repo.git.Root cause
parseGitHubRepoSlugFromURL(andextractHostFromRemoteURL) hardcodedgit@as the only valid SCP-style SSH username, so any GHE remote with a custom username silently fell through to the "no slug" path.Changes
parseGitHubRepoSlugFromURL— replace thegit@<host>:prefix check with a generalstrings.Cut(url, "@")split, then match<configuredHost>:on whatever follows. Handlesgit@github.com:owner/repoandexample@ghe.host:owner/repoequally.extractHostFromRemoteURL— same generalization for consistency; any[user@]host:pathSCP-style URL now extracts the host correctly.TestParseGitHubRepoSlugFromURLGHEcovers custom-username SSH, standardgit@SSH, HTTPS, SSH URL scheme, and a non-matching host guard. New case added toTestExtractHostFromRemoteURLfor custom-username SCP URLs.