MCPcopy Index your code
hub / github.com/github/github-mcp-server / resolveIssueNodeID

Function resolveIssueNodeID

pkg/github/projects.go:1513–1534  ·  view source on GitHub ↗

resolveIssueNodeID resolves an issue number to its GraphQL node ID

(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, issueNumber int)

Source from the content-addressed store, hash-verified

1511
1512// resolveIssueNodeID resolves an issue number to its GraphQL node ID
1513func resolveIssueNodeID(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, issueNumber int) (githubv4.ID, error) {
1514 var query struct {
1515 Repository struct {
1516 Issue struct {
1517 ID githubv4.ID
1518 } `graphql:"issue(number: $issueNumber)"`
1519 } `graphql:"repository(owner: $owner, name: $repo)"`
1520 }
1521
1522 variables := map[string]any{
1523 "owner": githubv4.String(owner),
1524 "repo": githubv4.String(repo),
1525 "issueNumber": githubv4.Int(int32(issueNumber)), //nolint:gosec // Issue numbers are small integers
1526 }
1527
1528 err := gqlClient.Query(ctx, &query, variables)
1529 if err != nil {
1530 return "", fmt.Errorf("failed to resolve issue %s/%s#%d: %w", owner, repo, issueNumber, err)
1531 }
1532
1533 return query.Repository.Issue.ID, nil
1534}
1535
1536// resolvePullRequestNodeID resolves a pull request number to its GraphQL node ID
1537func resolvePullRequestNodeID(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, prNumber int) (githubv4.ID, error) {

Callers 1

addProjectItemFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected