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

Method IssueOrPullRequestID

pkg/cmd/project/shared/queries/queries.go:1298–1317  ·  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

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

Callers 1

runAddItemFunction · 0.80

Calls 1

Tested by

no test coverage detected