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

Method IssueOrPullRequestID

pkg/cmd/project/shared/queries/queries.go:1297–1316  ·  view source on GitHub ↗

IssueOrPullRequestID returns the ID of the issue or pull request from a URL.

(rawURL string)

Source from the content-addressed store, hash-verified

1295
1296// IssueOrPullRequestID returns the ID of the issue or pull request from a URL.
1297func (c *Client) IssueOrPullRequestID(rawURL string) (string, error) {
1298 uri, err := url.Parse(rawURL)
1299 if err != nil {
1300 return "", err
1301 }
1302 variables := map[string]any{
1303 "url": githubv4.URI{URL: uri},
1304 }
1305 var query issueOrPullRequest
1306 err = c.doQueryWithProgressIndicator("GetIssueOrPullRequest", &query, variables)
1307 if err != nil {
1308 return "", err
1309 }
1310 if query.Resource.Typename == "Issue" {
1311 return query.Resource.Issue.ID, nil
1312 } else if query.Resource.Typename == "PullRequest" {
1313 return query.Resource.PullRequest.ID, nil
1314 }
1315 return "", errors.New("resource not found, please check the URL")
1316}
1317
1318// userProjects queries the $first projects of a user.
1319type userProjects struct {

Callers 1

runAddItemFunction · 0.80

Calls 1

Tested by

no test coverage detected