diff --git a/github/data_source_github_user.go b/github/data_source_github_user.go index c22c96e1ef..2f5cbcfde3 100644 --- a/github/data_source_github_user.go +++ b/github/data_source_github_user.go @@ -111,11 +111,11 @@ func dataSourceGithubUserRead(d *schema.ResourceData, meta interface{}) error { return err } - gpg, _, err := client.Users.ListGPGKeys(ctx, username, nil) + gpg, _, err := client.Users.ListGPGKeys(ctx, user.GetLogin(), nil) if err != nil { return err } - ssh, _, err := client.Users.ListKeys(ctx, username, nil) + ssh, _, err := client.Users.ListKeys(ctx, user.GetLogin(), nil) if err != nil { return err } diff --git a/website/docs/d/user.html.markdown b/website/docs/d/user.html.markdown index b3c051b0ae..467765f945 100644 --- a/website/docs/d/user.html.markdown +++ b/website/docs/d/user.html.markdown @@ -1,6 +1,7 @@ --- layout: "github" page_title: "GitHub: github_user" +sidebar_current: "docs-github-datasource-user" description: |- Get information on a GitHub user. --- @@ -12,14 +13,25 @@ Use this data source to retrieve information about a GitHub user. ## Example Usage ```hcl +# Retrieve information about a GitHub user. data "github_user" "example" { username = "example" } + +# Retrieve information about the currently authenticated user. +data "github_user" "current" { + username = "" +} + +output "current_github_login" { + value = "${data.github_user.current.login}" +} + ``` ## Argument Reference - * `username` - (Required) The username. + * `username` - (Required) The username. Use an empty string `""` to retrieve information about the currently authenticated user. ## Attributes Reference @@ -41,4 +53,3 @@ data "github_user" "example" { * `following` - the number of following users. * `created_at` - the creation date. * `updated_at` - the update date. -