feat: check all git remotes for GitHub URL in ci migrate preflight#472
feat: check all git remotes for GitHub URL in ci migrate preflight#472lukevmorris merged 1 commit intomainfrom
Conversation
Previously, detectRepoFromGitRemote only checked the 'origin' remote. Some customers have multiple remotes where origin does not point to GitHub. Now we iterate all configured remotes and pick the first one with a github.com URL. Also adds hostname validation to parseGitHubRepo to ensure non-GitHub remotes are correctly skipped.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Remotes not prioritized, may detect wrong repo
- Updated
detectRepoFromGitRemoteto resolve and validateoriginfirst, then fall back to other remotes while skippingoriginin the fallback loop.
- Updated
| return repo | ||
| } | ||
| } | ||
| return "" |
There was a problem hiding this comment.
Remotes not prioritized, may detect wrong repo
Low Severity
detectRepoFromGitRemote iterates remotes in .git/config order and picks the first GitHub match, without prioritizing origin. When a user has multiple GitHub remotes (e.g., upstream and origin), this may select the wrong repository if origin isn't listed first. In --yes mode, the result is used directly for ImportSecretsAndVars without displaying which repo was detected, so the user wouldn't notice. Checking origin first before falling back to other remotes would preserve the conventional expectation while still supporting non-origin setups.



Previously, detectRepoFromGitRemote only checked the 'origin' remote. This is not a safe assumption, as a github remote could be saved under any arbitrary name, and some users even have multiple remotes configured. Now we iterate all configured remotes and pick the first one with a github.com URL. Also adds hostname validation to parseGitHubRepo to ensure non-GitHub remotes are correctly skipped.
Note
Low Risk
Low risk CLI behavior change limited to repository detection; main risk is selecting an unintended GitHub remote when multiple are configured.
Overview
Improves
depot ci migraterepo detection by scanning all configured git remotes and selecting the first URL that parses as agithub.comrepo, instead of assuming anoriginremote.Tightens
parseGitHubRepoto validate the hostname for both SSH and HTTPS remotes (skipping non-GitHub hosts), updates the related user-facing error messages, and adds unit tests covering common URL formats and non-GitHub cases.Written by Cursor Bugbot for commit c34f1dd. This will update automatically on new commits. Configure here.