@@ -109,14 +109,25 @@ func detectVariablesFromWorkflows(workflows []*migrate.WorkflowFile) ([]string,
109109 return deduped , nil
110110}
111111
112- // detectRepoFromGitRemote attempts to extract owner/repo from the origin remote URL.
112+ // detectRepoFromGitRemote attempts to extract owner/repo from a GitHub remote URL.
113+ // It checks all configured remotes for a GitHub URL.
113114func detectRepoFromGitRemote (dir string ) string {
114- cmd := exec .Command ("git" , "-C" , dir , "remote" , "get-url" , "origin" )
115+ cmd := exec .Command ("git" , "-C" , dir , "remote" )
115116 out , err := cmd .Output ()
116117 if err != nil {
117118 return ""
118119 }
119- return parseGitHubRepo (strings .TrimSpace (string (out )))
120+ for _ , name := range strings .Fields (string (out )) {
121+ urlCmd := exec .Command ("git" , "-C" , dir , "remote" , "get-url" , name )
122+ urlOut , err := urlCmd .Output ()
123+ if err != nil {
124+ continue
125+ }
126+ if repo := parseGitHubRepo (strings .TrimSpace (string (urlOut ))); repo != "" {
127+ return repo
128+ }
129+ }
130+ return ""
120131}
121132
122133func parseGitHubRepo (remoteURL string ) string {
@@ -126,6 +137,10 @@ func parseGitHubRepo(remoteURL string) string {
126137 if idx < 0 {
127138 return ""
128139 }
140+ host := remoteURL [len ("git@" ):idx ]
141+ if host != "github.com" {
142+ return ""
143+ }
129144 path := remoteURL [idx + 1 :]
130145 path = strings .TrimSuffix (path , ".git" )
131146 parts := strings .SplitN (path , "/" , 3 )
@@ -140,6 +155,9 @@ func parseGitHubRepo(remoteURL string) string {
140155 if err != nil {
141156 return ""
142157 }
158+ if u .Host != "github.com" {
159+ return ""
160+ }
143161 path := strings .TrimPrefix (u .Path , "/" )
144162 path = strings .TrimSuffix (path , ".git" )
145163 path = strings .TrimRight (path , "/" )
0 commit comments