Skip to content

Latest commit

 

History

History
69 lines (56 loc) · 2.02 KB

File metadata and controls

69 lines (56 loc) · 2.02 KB
page_title github_user (Data Source) - GitHub
description Get information on a GitHub user.

github_user (Data Source)

Use this data source to retrieve information about a GitHub user.

Example Usage

# 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
}

Lookup by stable user ID

# Retrieve information about a GitHub user by their stable numeric ID.
# Useful when the user may rename themselves: the lookup keeps working.
data "github_user" "by_id" {
  user_id = 1
}

Argument Reference

Exactly one of the following must be set:

  • username - (Optional) The username (login). Use an empty string "" to retrieve information about the currently authenticated user.
  • user_id - (Optional) The GitHub numeric user ID. Stable across username changes, so prefer this if you need lookups that survive a rename.

Attributes Reference

  • id - the ID of the user.
  • user_id - the GitHub numeric user ID (same value as id, also settable as an input).
  • node_id - the Node ID of the user.
  • login - the user's login.
  • avatar_url - the user's avatar URL.
  • gravatar_id - the user's gravatar ID.
  • site_admin - whether the user is a GitHub admin.
  • name - the user's full name.
  • company - the user's company name.
  • blog - the user's blog location.
  • location - the user's location.
  • email - the user's email.
  • gpg_keys - list of user's GPG keys.
  • ssh_keys - list of user's SSH keys.
  • bio - the user's bio.
  • public_repos - the number of public repositories.
  • public_gists - the number of public gists.
  • followers - the number of followers.
  • following - the number of following users.
  • created_at - the creation date.
  • updated_at - the update date.
  • suspended_at - the suspended date if the user is suspended.