GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi
github.getUser
Explore with Pulumi AI
Use this data source to retrieve information about a GitHub user.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
// Retrieve information about a GitHub user.
const example = github.getUser({
    username: "example",
});
// Retrieve information about the currently authenticated user.
const current = github.getUser({
    username: "",
});
export const currentGithubLogin = current.then(current => current.login);
import pulumi
import pulumi_github as github
# Retrieve information about a GitHub user.
example = github.get_user(username="example")
# Retrieve information about the currently authenticated user.
current = github.get_user(username="")
pulumi.export("currentGithubLogin", current.login)
package main
import (
	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Retrieve information about a GitHub user.
		_, err := github.GetUser(ctx, &github.GetUserArgs{
			Username: "example",
		}, nil)
		if err != nil {
			return err
		}
		// Retrieve information about the currently authenticated user.
		current, err := github.GetUser(ctx, &github.GetUserArgs{
			Username: "",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("currentGithubLogin", current.Login)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() => 
{
    // Retrieve information about a GitHub user.
    var example = Github.GetUser.Invoke(new()
    {
        Username = "example",
    });
    // Retrieve information about the currently authenticated user.
    var current = Github.GetUser.Invoke(new()
    {
        Username = "",
    });
    return new Dictionary<string, object?>
    {
        ["currentGithubLogin"] = current.Apply(getUserResult => getUserResult.Login),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.GithubFunctions;
import com.pulumi.github.inputs.GetUserArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        // Retrieve information about a GitHub user.
        final var example = GithubFunctions.getUser(GetUserArgs.builder()
            .username("example")
            .build());
        // Retrieve information about the currently authenticated user.
        final var current = GithubFunctions.getUser(GetUserArgs.builder()
            .username("")
            .build());
        ctx.export("currentGithubLogin", current.applyValue(getUserResult -> getUserResult.login()));
    }
}
variables:
  # Retrieve information about a GitHub user.
  example:
    fn::invoke:
      function: github:getUser
      arguments:
        username: example
  # Retrieve information about the currently authenticated user.
  current:
    fn::invoke:
      function: github:getUser
      arguments:
        username: ""
outputs:
  currentGithubLogin: ${current.login}
Using getUser
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getUser(args: GetUserArgs, opts?: InvokeOptions): Promise<GetUserResult>
function getUserOutput(args: GetUserOutputArgs, opts?: InvokeOptions): Output<GetUserResult>def get_user(username: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetUserResult
def get_user_output(username: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]func GetUser(ctx *Context, args *GetUserArgs, opts ...InvokeOption) (*GetUserResult, error)
func GetUserOutput(ctx *Context, args *GetUserOutputArgs, opts ...InvokeOption) GetUserResultOutput> Note: This function is named GetUser in the Go SDK.
public static class GetUser 
{
    public static Task<GetUserResult> InvokeAsync(GetUserArgs args, InvokeOptions? opts = null)
    public static Output<GetUserResult> Invoke(GetUserInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
public static Output<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
fn::invoke:
  function: github:index/getUser:getUser
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Username string
 - The username. Use an empty string 
""to retrieve information about the currently authenticated user. 
- Username string
 - The username. Use an empty string 
""to retrieve information about the currently authenticated user. 
- username String
 - The username. Use an empty string 
""to retrieve information about the currently authenticated user. 
- username string
 - The username. Use an empty string 
""to retrieve information about the currently authenticated user. 
- username str
 - The username. Use an empty string 
""to retrieve information about the currently authenticated user. 
- username String
 - The username. Use an empty string 
""to retrieve information about the currently authenticated user. 
getUser Result
The following output properties are available:
- Avatar
Url string - the user's avatar URL.
 - Bio string
 - the user's bio.
 - Blog string
 - the user's blog location.
 - Company string
 - the user's company name.
 - Created
At string - the creation date.
 - Email string
 - the user's email.
 - Followers int
 - the number of followers.
 - Following int
 - the number of following users.
 - Gpg
Keys List<string> - list of user's GPG keys.
 - Gravatar
Id string - the user's gravatar ID.
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Location string
 - the user's location.
 - Login string
 - the user's login.
 - Name string
 - the user's full name.
 - Node
Id string - the Node ID of the user.
 - Public
Gists int - the number of public gists.
 - Public
Repos int - the number of public repositories.
 - Site
Admin bool - whether the user is a GitHub admin.
 - Ssh
Keys List<string> - list of user's SSH keys.
 - Suspended
At string - the suspended date if the user is suspended.
 - Updated
At string - the update date.
 - Username string
 
- Avatar
Url string - the user's avatar URL.
 - Bio string
 - the user's bio.
 - Blog string
 - the user's blog location.
 - Company string
 - the user's company name.
 - Created
At string - the creation date.
 - Email string
 - the user's email.
 - Followers int
 - the number of followers.
 - Following int
 - the number of following users.
 - Gpg
Keys []string - list of user's GPG keys.
 - Gravatar
Id string - the user's gravatar ID.
 - Id string
 - The provider-assigned unique ID for this managed resource.
 - Location string
 - the user's location.
 - Login string
 - the user's login.
 - Name string
 - the user's full name.
 - Node
Id string - the Node ID of the user.
 - Public
Gists int - the number of public gists.
 - Public
Repos int - the number of public repositories.
 - Site
Admin bool - whether the user is a GitHub admin.
 - Ssh
Keys []string - list of user's SSH keys.
 - Suspended
At string - the suspended date if the user is suspended.
 - Updated
At string - the update date.
 - Username string
 
- avatar
Url String - the user's avatar URL.
 - bio String
 - the user's bio.
 - blog String
 - the user's blog location.
 - company String
 - the user's company name.
 - created
At String - the creation date.
 - email String
 - the user's email.
 - followers Integer
 - the number of followers.
 - following Integer
 - the number of following users.
 - gpg
Keys List<String> - list of user's GPG keys.
 - gravatar
Id String - the user's gravatar ID.
 - id String
 - The provider-assigned unique ID for this managed resource.
 - location String
 - the user's location.
 - login String
 - the user's login.
 - name String
 - the user's full name.
 - node
Id String - the Node ID of the user.
 - public
Gists Integer - the number of public gists.
 - public
Repos Integer - the number of public repositories.
 - site
Admin Boolean - whether the user is a GitHub admin.
 - ssh
Keys List<String> - list of user's SSH keys.
 - suspended
At String - the suspended date if the user is suspended.
 - updated
At String - the update date.
 - username String
 
- avatar
Url string - the user's avatar URL.
 - bio string
 - the user's bio.
 - blog string
 - the user's blog location.
 - company string
 - the user's company name.
 - created
At string - the creation date.
 - email string
 - the user's email.
 - followers number
 - the number of followers.
 - following number
 - the number of following users.
 - gpg
Keys string[] - list of user's GPG keys.
 - gravatar
Id string - the user's gravatar ID.
 - id string
 - The provider-assigned unique ID for this managed resource.
 - location string
 - the user's location.
 - login string
 - the user's login.
 - name string
 - the user's full name.
 - node
Id string - the Node ID of the user.
 - public
Gists number - the number of public gists.
 - public
Repos number - the number of public repositories.
 - site
Admin boolean - whether the user is a GitHub admin.
 - ssh
Keys string[] - list of user's SSH keys.
 - suspended
At string - the suspended date if the user is suspended.
 - updated
At string - the update date.
 - username string
 
- avatar_
url str - the user's avatar URL.
 - bio str
 - the user's bio.
 - blog str
 - the user's blog location.
 - company str
 - the user's company name.
 - created_
at str - the creation date.
 - email str
 - the user's email.
 - followers int
 - the number of followers.
 - following int
 - the number of following users.
 - gpg_
keys Sequence[str] - list of user's GPG keys.
 - gravatar_
id str - the user's gravatar ID.
 - id str
 - The provider-assigned unique ID for this managed resource.
 - location str
 - the user's location.
 - login str
 - the user's login.
 - name str
 - the user's full name.
 - node_
id str - the Node ID of the user.
 - public_
gists int - the number of public gists.
 - public_
repos int - the number of public repositories.
 - site_
admin bool - whether the user is a GitHub admin.
 - ssh_
keys Sequence[str] - list of user's SSH keys.
 - suspended_
at str - the suspended date if the user is suspended.
 - updated_
at str - the update date.
 - username str
 
- avatar
Url String - the user's avatar URL.
 - bio String
 - the user's bio.
 - blog String
 - the user's blog location.
 - company String
 - the user's company name.
 - created
At String - the creation date.
 - email String
 - the user's email.
 - followers Number
 - the number of followers.
 - following Number
 - the number of following users.
 - gpg
Keys List<String> - list of user's GPG keys.
 - gravatar
Id String - the user's gravatar ID.
 - id String
 - The provider-assigned unique ID for this managed resource.
 - location String
 - the user's location.
 - login String
 - the user's login.
 - name String
 - the user's full name.
 - node
Id String - the Node ID of the user.
 - public
Gists Number - the number of public gists.
 - public
Repos Number - the number of public repositories.
 - site
Admin Boolean - whether the user is a GitHub admin.
 - ssh
Keys List<String> - list of user's SSH keys.
 - suspended
At String - the suspended date if the user is suspended.
 - updated
At String - the update date.
 - username String
 
Package Details
- Repository
 - GitHub pulumi/pulumi-github
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
githubTerraform Provider.