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

Function ParseRunURLExtended

pkg/parser/github_urls.go:289–309  ·  view source on GitHub ↗

ParseRunURLExtended is similar to ParseRunURL but returns additional information including job ID and step details from deep URLs.

(input string)

Source from the content-addressed store, hash-verified

287// ParseRunURLExtended is similar to ParseRunURL but returns additional information
288// including job ID and step details from deep URLs.
289func ParseRunURLExtended(input string) (*GitHubURLComponents, error) {
290 // First try to parse as a direct numeric ID
291 if runID, err := strconv.ParseInt(input, 10, 64); err == nil {
292 return &GitHubURLComponents{
293 Type: URLTypeRun,
294 Number: runID,
295 }, nil
296 }
297
298 // Try to parse as a GitHub URL
299 components, err := ParseGitHubURL(input)
300 if err != nil {
301 return nil, fmt.Errorf("invalid run ID or URL '%s': must be a numeric run ID or a GitHub URL containing '/actions/runs/{run-id}' or '/runs/{run-id}'", input)
302 }
303
304 if components.Type != URLTypeRun {
305 return nil, errors.New("URL is not a GitHub Actions run URL")
306 }
307
308 return components, nil
309}
310
311// ParsePRURL is a convenience function that parses a GitHub PR URL and extracts PR information.
312// Expected format: https://github.com/owner/repo/pull/123 or https://github.enterprise.com/owner/repo/pull/123

Callers 6

runAuditSingleFunction · 0.92
runAuditMultiFunction · 0.92
NewViewCommandFunction · 0.92
TestParseRunURLFunction · 0.85

Calls 2

ParseGitHubURLFunction · 0.85
ErrorfMethod · 0.45

Tested by 1

TestParseRunURLFunction · 0.68