parseRepoFromURL extracts owner/repo from a GitHub URL.
(url string)
| 332 | |
| 333 | // parseRepoFromURL extracts owner/repo from a GitHub URL. |
| 334 | func parseRepoFromURL(url string) string { |
| 335 | // https://github.com/owner/repo/... |
| 336 | const prefix = "github.com/" |
| 337 | _, rest, found := strings.Cut(url, prefix) |
| 338 | if !found { |
| 339 | return "" |
| 340 | } |
| 341 | parts := strings.SplitN(rest, "/", 3) |
| 342 | if len(parts) >= 2 { |
| 343 | return parts[0] + "/" + parts[1] |
| 344 | } |
| 345 | return "" |
| 346 | } |
| 347 | |
| 348 | // isBotUser returns true if the login looks like a bot account. |
| 349 | func isBotUser(login string) bool { |
no outgoing calls