MCPcopy Create free account
hub / github.com/cli/cli / ParseSessionIDFromURL

Function ParseSessionIDFromURL

pkg/cmd/agent-task/shared/capi.go:79–90  ·  view source on GitHub ↗

ParseSessionIDFromURL parses session ID from a pull request's agent session URL, which is of the form: `https://github.com/OWNER/REPO/pull/NUMBER/agent-sessions/SESSION-ID`

(u string)

Source from the content-addressed store, hash-verified

77//
78// `https://github.com/OWNER/REPO/pull/NUMBER/agent-sessions/SESSION-ID`
79func ParseSessionIDFromURL(u string) (string, error) {
80 _, _, rest, err := prShared.ParseURL(u)
81 if err != nil {
82 return "", err
83 }
84
85 match := agentSessionURLRegexp.FindStringSubmatch(rest)
86 if match == nil {
87 return "", errors.New("not a valid agent session URL")
88 }
89 return match[1], nil
90}

Callers 1

Calls

no outgoing calls

Tested by 1