getHostFromOriginRemote returns the hostname of the git remote. It prefers the 'origin' remote for backward compatibility. If 'origin' is not configured but exactly one other remote exists, that remote is used instead. For example, a remote URL of "https://ghes.example.com/org/repo.git" returns "ghe
()
| 201 | // and "git@github.com:owner/repo.git" returns "github.com". |
| 202 | // Returns "github.com" as the default if the remote URL cannot be determined. |
| 203 | func getHostFromOriginRemote() string { |
| 204 | remoteURL, remoteName, err := resolveRemoteURL("") |
| 205 | if err != nil { |
| 206 | gitLog.Printf("Failed to resolve remote URL: %v", err) |
| 207 | return "github.com" |
| 208 | } |
| 209 | |
| 210 | host := extractHostFromRemoteURL(remoteURL) |
| 211 | gitLog.Printf("Detected GitHub host from remote %q: %s", remoteName, host) |
| 212 | return host |
| 213 | } |
| 214 | |
| 215 | // getRepositorySlugFromRemote extracts the repository slug (owner/repo) from git remote URL. |
| 216 | // It prefers the 'origin' remote for backward compatibility. If 'origin' is not |