MCPcopy Create free account
hub / github.com/github/gh-aw / parseNumberFromURL

Function parseNumberFromURL

pkg/cli/outcome_eval.go:322–331  ·  view source on GitHub ↗

parseNumberFromURL extracts a number from a GitHub URL like https://github.com/owner/repo/pull/42 or .../issues/108

(url string)

Source from the content-addressed store, hash-verified

320// parseNumberFromURL extracts a number from a GitHub URL like
321// https://github.com/owner/repo/pull/42 or .../issues/108
322func parseNumberFromURL(url string) int {
323 parts := strings.Split(url, "/")
324 for i := range slices.Backward(parts) {
325 var n int
326 if _, err := fmt.Sscanf(parts[i], "%d", &n); err == nil && n > 0 {
327 return n
328 }
329 }
330 return 0
331}
332
333// parseRepoFromURL extracts owner/repo from a GitHub URL.
334func parseRepoFromURL(url string) string {

Callers 3

TestParseNumberFromURLFunction · 0.85
evalAddCommentFunction · 0.85
resolveItemNumberFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestParseNumberFromURLFunction · 0.68