resolvePullRequestNodeID resolves a pull request number to its GraphQL node ID
(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, prNumber int)
| 1535 | |
| 1536 | // resolvePullRequestNodeID resolves a pull request number to its GraphQL node ID |
| 1537 | func resolvePullRequestNodeID(ctx context.Context, gqlClient *githubv4.Client, owner, repo string, prNumber int) (githubv4.ID, error) { |
| 1538 | var query struct { |
| 1539 | Repository struct { |
| 1540 | PullRequest struct { |
| 1541 | ID githubv4.ID |
| 1542 | } `graphql:"pullRequest(number: $prNumber)"` |
| 1543 | } `graphql:"repository(owner: $owner, name: $repo)"` |
| 1544 | } |
| 1545 | |
| 1546 | variables := map[string]any{ |
| 1547 | "owner": githubv4.String(owner), |
| 1548 | "repo": githubv4.String(repo), |
| 1549 | "prNumber": githubv4.Int(int32(prNumber)), //nolint:gosec // PR numbers are small integers |
| 1550 | } |
| 1551 | |
| 1552 | err := gqlClient.Query(ctx, &query, variables) |
| 1553 | if err != nil { |
| 1554 | return "", fmt.Errorf("failed to resolve pull request %s/%s#%d: %w", owner, repo, prNumber, err) |
| 1555 | } |
| 1556 | |
| 1557 | return query.Repository.PullRequest.ID, nil |
| 1558 | } |
| 1559 | |
| 1560 | // createProject handles the create_project method for ProjectsWrite. |
| 1561 | func createProject(ctx context.Context, gqlClient *githubv4.Client, owner, ownerType string, args map[string]any) (*mcp.CallToolResult, any, error) { |
no test coverage detected