1. Packages
  2. Packages
  3. Github Provider
  4. API Docs
  5. getUsers
Viewing docs for GitHub v4.17.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
github logo
Viewing docs for GitHub v4.17.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Use this data source to retrieve information about multiple GitHub users at once.

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Github.GetUsers.Invoke(new()
        {
            Usernames = new[]
            {
                "example1",
                "example2",
                "example3",
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["validUsers"] = example.Apply(getUsersResult => getUsersResult.Logins),
            ["invalidUsers"] = example.Apply(getUsersResult => getUsersResult.UnknownLogins),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v4/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := github.GetUsers(ctx, &GetUsersArgs{
    			Usernames: []string{
    				"example1",
    				"example2",
    				"example3",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("validUsers", example.Logins)
    		ctx.Export("invalidUsers", example.UnknownLogins)
    		return nil
    	})
    }
    
    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.GetUsersArgs;
    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) {
            final var example = GithubFunctions.getUsers(GetUsersArgs.builder()
                .usernames(            
                    "example1",
                    "example2",
                    "example3")
                .build());
    
            ctx.export("validUsers", example.applyValue(getUsersResult -> getUsersResult.logins()));
            ctx.export("invalidUsers", example.applyValue(getUsersResult -> getUsersResult.unknownLogins()));
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    // Retrieve information about multiple GitHub users.
    const example = pulumi.output(github.getUsers({
        usernames: [
            "example1",
            "example2",
            "example3",
        ],
    }));
    
    export const validUsers = example.logins;
    export const invalidUsers = example.unknownLogins;
    
    import pulumi
    import pulumi_github as github
    
    example = github.get_users(usernames=[
        "example1",
        "example2",
        "example3",
    ])
    pulumi.export("validUsers", example.logins)
    pulumi.export("invalidUsers", example.unknown_logins)
    
    variables:
      example:
        Fn::Invoke:
          Function: github:getUsers
          Arguments:
            usernames:
              - example1
              - example2
              - example3
    outputs:
      validUsers: ${example.logins}
      invalidUsers: ${example.unknownLogins}
    

    Using getUsers

    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 getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
    function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOptions): Output<GetUsersResult>
    def get_users(usernames: Optional[Sequence[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetUsersResult
    def get_users_output(usernames: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]
    func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
    func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput

    > Note: This function is named GetUsers in the Go SDK.

    public static class GetUsers 
    {
        public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
        public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    public static Output<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    
    fn::invoke:
      function: github:index/getUsers:getUsers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Usernames List<string>
    List of usernames.
    Usernames []string
    List of usernames.
    usernames List<String>
    List of usernames.
    usernames string[]
    List of usernames.
    usernames Sequence[str]
    List of usernames.
    usernames List<String>
    List of usernames.

    getUsers Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Logins List<string>
    list of logins of users that could be found.
    NodeIds List<string>
    list of Node IDs of users that could be found.
    UnknownLogins List<string>
    list of logins without matching user.
    Usernames List<string>
    Id string
    The provider-assigned unique ID for this managed resource.
    Logins []string
    list of logins of users that could be found.
    NodeIds []string
    list of Node IDs of users that could be found.
    UnknownLogins []string
    list of logins without matching user.
    Usernames []string
    id String
    The provider-assigned unique ID for this managed resource.
    logins List<String>
    list of logins of users that could be found.
    nodeIds List<String>
    list of Node IDs of users that could be found.
    unknownLogins List<String>
    list of logins without matching user.
    usernames List<String>
    id string
    The provider-assigned unique ID for this managed resource.
    logins string[]
    list of logins of users that could be found.
    nodeIds string[]
    list of Node IDs of users that could be found.
    unknownLogins string[]
    list of logins without matching user.
    usernames string[]
    id str
    The provider-assigned unique ID for this managed resource.
    logins Sequence[str]
    list of logins of users that could be found.
    node_ids Sequence[str]
    list of Node IDs of users that could be found.
    unknown_logins Sequence[str]
    list of logins without matching user.
    usernames Sequence[str]
    id String
    The provider-assigned unique ID for this managed resource.
    logins List<String>
    list of logins of users that could be found.
    nodeIds List<String>
    list of Node IDs of users that could be found.
    unknownLogins List<String>
    list of logins without matching user.
    usernames List<String>

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    Viewing docs for GitHub v4.17.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.