Community packages

@kentcdodds/github

by @kentcdodds

Account-aware GitHub REST, GraphQL, and pull request helpers for Kody agents, with documented guidance for choosing between saved GitHub credentials.

  • github
  • api
  • accounts
  • pr
  • automation
License
MIT
Published
7/9/2026
Pinned commit
3e410d0
Rating
No ratings yet
Adaptation effort
Forks
0

Fork with your agent

Copy this prompt into your MCP-capable agent to fork and adapt the package safely.

Use Kody to fork the community package "@kentcdodds/github" (listing id: d3f57bda-5d56-4127-93f5-d8b6a38f7c0f). Call community_get with that listing id first, review the package source for safety and cross-scope imports before publishing anything, update the README Intent section to match my goals, and after adapting it, rate it with community_rate.

README

# @kentcdodds/github

## Intent

Account-aware GitHub REST, GraphQL, and pull request helpers for Kody agents — centralizes credential selection, headers, parsing, and pagination so agents do not hand-roll GitHub API glue.

## When To Use

- Make GitHub REST or GraphQL calls with the correct saved credential (`request`, `graphql`, `paginate`).
- Verify which GitHub identity will perform an action (`get-viewer`).
- Fetch PR details, CI checks, merge, or change draft/ready status (`pr/*` exports).
- Choose between `bot`, `kent`, or `kent-explicit-only` accounts for an operation.

## Required setup

Three saved GitHub token secrets (user scope), one per account alias:

- `githubAccessToken` — `bot` account (default for routine automation).
- `github-kentAccessToken` — `kent` OAuth identity.
- `githubPatKentcdoddsExplicitOnly` — personal token when the user explicitly requests it.

## Account guide

| Account | Default | Use when |
| --- | --- | --- |
| `bot` | Yes | Routine automation, agent PRs, repo reads, normal API work. |
| `kent` | No | Kent OAuth identity for private repos or user-scoped permissions the bot lacks. |
| `kent-explicit-only` | No | User explicitly asks for the personal `kentcdodds` token. |

All PR helpers accept optional `account` (default `'bot'`). PR locators: `{ prUrl }` or `{ owner, repo, prNumber }` (`number` aliases `prNumber`).

## Exports

- `kody:@kentcdodds/github` — package overview
- `kody:@kentcdodds/github/accounts` — account aliases and selection guidance
- `kody:@kentcdodds/github/get-viewer` — identity smoke test
- `kody:@kentcdodds/github/graphql` — GraphQL helper
- `kody:@kentcdodds/github/paginate` — REST pagination helper
- `kody:@kentcdodds/github/request` — REST request helper
- `kody:@kentcdodds/github/types` — shared TypeScript types
- `kody:@kentcdodds/github/pr/get-info` — fetch pull request details
- `kody:@kentcdodds/github/pr/get-checks` — fetch check-run status
- `kody:@kentcdodds/github/pr/merge` — merge a pull request
- `kody:@kentcdodds/github/pr/set-review-status` — set draft, ready-for-review, or toggle (`status: 'toggle'`)

## Examples

REST request:

```ts
import githubRequest from 'kody:@kentcdodds/github/request'

const response = await githubRequest({
  account: 'bot',
  path: '/repos/kentcdodds/kody',
  throwOnError: true,
})
return response.data
```

PR info with account:

```ts
import getPrInfo from 'kody:@kentcdodds/github/pr/get-info'

return await getPrInfo({
  owner: 'kentcdodds',
  repo: 'kentcdodds.com',
  prNumber: 1,
  account: 'bot',
})
```

Report this listing

Log in to report this listing.