MCPcopy Index your code
hub / github.com/cli/cli / IssueOrPullRequestID

Method IssueOrPullRequestID

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

1255
1256// IssueOrPullRequestID returns the ID of the issue or pull request from a URL.
1257func (c *Client) IssueOrPullRequestID(rawURL string) (string, error) {
1258 uri, err := url.Parse(rawURL)
1259 if err != nil {
1260 return "", err
1261 }
1262 variables := map[string]interface{}{
1263 "url": githubv4.URI{URL: uri},
1264 }
1265 var query issueOrPullRequest
1266 err = c.doQueryWithProgressIndicator("GetIssueOrPullRequest", &query, variables)
1267 if err != nil {
1268 return "", err
1269 }
1270 if query.Resource.Typename == "Issue" {
1271 return query.Resource.Issue.ID, nil
1272 } else if query.Resource.Typename == "PullRequest" {
1273 return query.Resource.PullRequest.ID, nil
1274 }
1275 return "", errors.New("resource not found, please check the URL")
1276}
1277
1278// userProjects queries the $first projects of a user.
1279type userProjects struct {

Callers 1

runAddItemFunction · 0.80

Calls 1

Tested by

no test coverage detected