# @changesets/get-github-info

> Get the GitHub username and PR number from a commit. Intended for use with changesets.

Latest version **1.0.1** (published 2026-09-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @changesets/get-github-info
pnpm add @changesets/get-github-info
yarn add @changesets/get-github-info
bun add @changesets/get-github-info
```

## Health

**Score 70/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2026-09-04 |
| First published | 2019-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^22.11 \|\| ^24 \|\| >=26 |
| Dependencies | 1 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 12397 |
| Maintainers | emmatown, andarist |

## Links

- npm: https://www.npmjs.com/package/@changesets/get-github-info
- Repository: https://github.com/changesets/changesets
- npm.io page: https://npm.io/package/@changesets/get-github-info

## Dependencies (1)

- [dataloader](https://npm.io/package/dataloader.md) ^2.2.3

## Recent versions

- 1.0.1 (latest) — 2026-09-04
- 1.0.0-next.4 (next) — 2026-07-17
- 1.0.0 — 2026-08-11
- 1.0.0-next.3 — 2026-07-01
- 1.0.0-next.2 — 2026-05-07
- 0.8.0 — 2026-03-03
- 0.7.0 — 2025-11-27
- 1.0.0-next.1 — 2025-10-30
- 1.0.0-next.0 — 2025-04-21
- 0.6.0 — 2023-11-28
- 0.5.2 — 2022-12-18
- 0.5.1 — 2022-06-11
- 0.5.0 — 2021-03-09
- 0.4.5 — 2021-01-14
- 0.4.4 — 2020-08-17
- … 12 more at https://npm.io/package/@changesets/get-github-info/versions

## README

# @changesets/get-github-info

[![Open on npmx.dev](https://npmx.dev/api/registry/badge/version/@changesets/get-github-info?name=true)](https://npmx.dev/package/@changesets/get-github-info)
[![View changelog](https://npmx.dev/api/registry/badge/version/@changesets/cli?color=229fe4&value=View+changelog&label=+)](./CHANGELOG.md)

Get GitHub author and associated PR information for a commit or pull request. Intended for use with changesets.

## Getting Started

> Note: This assumes you already have changesets setup.

You can use `@changesets/get-github-info` like this if you have a [custom changelog formatter](https://changesets.dev/guide/customize-changelog-format).

```js
import { getCommitInfo } from "@changesets/get-github-info";

// ...

const getReleaseLine = async (changeset, type) => {
  const [firstLine, ...futureLines] = changeset.summary
    .split("\n")
    .map((l) => l.trimEnd());

  const info = await getCommitInfo({
    // replace this with your own repo
    repo: "changesets/changesets",
    commit: changeset.commit,
  });
  if (info == null) {
    // may be null if referenced the wrong repo, or the commit has not been pushed
    // to the repo yet
    throw new Error(`Could not get GitHub info for commit ${changeset.commit}`);
  }

  let returnVal = `- [${changeset.commit.sha.slice(0, 7)}](${info.commit.url})`;
  if (info.pull != null) {
    returnVal += ` ([#${info.pull.number}](${info.pull.url})`;
  }
  if (info.author != null) {
    returnVal += ` Thanks [@${info.author.login}](${info.author.url})!`;
  }
  returnVal += `: ${firstLine}`;
  if (futureLines.length > 0) {
    returnVal += `\n${futureLines.map((l) => `  ${l}`).join("\n")}`;
  }
  return returnVal;
};

// ...
```

You'll need to [get a GitHub personal access token](https://github.com/settings/tokens/new?scopes=read:user,repo:status&description=changesets) with `read:user` and `repo:status` permissions, and add it to a `.env` file (it'll be loaded automatically).

```bash
GITHUB_TOKEN=token_here
```

You can now bump your packages and changelogs with `changeset version` and it'll have the GitHub info. 🎉

### GitHub Enterprise Server

If you are using GitHub Enterprise Server, you can configure `@changesets/get-github-info` to point at it using the following
environment variables:

```bash
GITHUB_SERVER_URL=https://github.example.com
GITHUB_GRAPHQL_URL=https://github.example.com/api/graphql
```

When using GitHub Actions, these environment variables will already have been set.

---
_Source: https://npm.io/package/@changesets/get-github-info · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
