get User
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);
Content copied to clipboard
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)
Content copied to clipboard
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),
};
});
Content copied to clipboard
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
})
}
Content copied to clipboard
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()));
}
}
Content copied to clipboard
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}
Content copied to clipboard
Return
A collection of values returned by getUser.
Parameters
argument
A collection of arguments for invoking getUser.
Return
A collection of values returned by getUser.
Parameters
username
The username. Use an empty string ""
to retrieve information about the currently authenticated user.
See also
Return
A collection of values returned by getUser.
Parameters
argument
Builder for com.pulumi.github.kotlin.inputs.GetUserPlainArgs.