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

Function getOwnerNodeID

pkg/github/projects.go:1769–1793  ·  view source on GitHub ↗

getOwnerNodeID resolves a GitHub user or organization login to its GraphQL node ID.

(ctx context.Context, gqlClient *githubv4.Client, owner, ownerType string)

Source from the content-addressed store, hash-verified

1767
1768// getOwnerNodeID resolves a GitHub user or organization login to its GraphQL node ID.
1769func getOwnerNodeID(ctx context.Context, gqlClient *githubv4.Client, owner, ownerType string) (string, error) {
1770 if ownerType == "org" {
1771 var query struct {
1772 Organization struct {
1773 ID string
1774 } `graphql:"organization(login: $login)"`
1775 }
1776 variables := map[string]any{
1777 "login": githubv4.String(owner),
1778 }
1779 err := gqlClient.Query(ctx, &query, variables)
1780 return query.Organization.ID, err
1781 }
1782
1783 var query struct {
1784 User struct {
1785 ID string
1786 } `graphql:"user(login: $login)"`
1787 }
1788 variables := map[string]any{
1789 "login": githubv4.String(owner),
1790 }
1791 err := gqlClient.Query(ctx, &query, variables)
1792 return query.User.ID, err
1793}
1794
1795// UpdateProjectV2FieldInput is the GraphQL input for the updateProjectV2Field mutation.
1796// These types are defined locally because the pinned shurcooL/githubv4 release

Callers 1

createProjectFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected