Skip to content

Commit

Permalink
Allow github_user data source to retrieve information about the cur…
Browse files Browse the repository at this point in the history
…rently authenticated github user (integrations#261)
  • Loading branch information
mithun authored Nov 5, 2020
1 parent 1726e83 commit a29cf42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions github/data_source_github_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
14 changes: 12 additions & 2 deletions website/docs/d/user.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,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

Expand All @@ -42,4 +53,3 @@ data "github_user" "example" {
* `following` - the number of following users.
* `created_at` - the creation date.
* `updated_at` - the update date.

0 comments on commit a29cf42

Please sign in to comment.