Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/github

src/get-viewer.ts

17 lines · 638 B · TypeScript
import type { GitHubAccount } from "./types"
export { getViewer } from "./core"
import { getViewer } from "./core"

/**
 * Verify which GitHub identity a selected account alias resolves to.
 *
 * @param params.account - Credential alias; defaults to `bot`.
 * @returns Viewer login, id, type, and profile URLs.
 * @example
 * import getGithubViewer from 'kody:@kentcdodds/github/get-viewer'
 * const viewer = await getGithubViewer({ account: 'bot' })
 * // => { account: 'bot', login: 'kody-bot', id: 12345 }
 */
export default async function getGithubViewer(params: { account?: GitHubAccount } = {}) {
  return await getViewer(params)
}