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

Method IssueOrPullRequestID

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

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

Callers 1

runAddItemFunction · 0.80

Calls 1

Tested by

no test coverage detected