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)
| 77 | // |
| 78 | // `https://github.com/OWNER/REPO/pull/NUMBER/agent-sessions/SESSION-ID` |
| 79 | func 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 | } |
no outgoing calls