package
Get the GitHub username and PR number from a commit. Intended for use with changesets.
npm install @changesets/get-github-infoGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 2 packages.
73.0 kB
Includes dependencies.
Latest published Sep 4, 2026
latest
next
Get GitHub author and associated PR information for a commit or pull request. Intended for use with changesets.
Note: This assumes you already have changesets setup.
You can use @changesets/get-github-info like this if you have a custom changelog formatter.
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
You'll need to get a GitHub personal access token with read:user and repo:status permissions, and add it to a .env file (it'll be loaded automatically).
GITHUB_TOKEN=token_hereYou can now bump your packages and changelogs with changeset version and it'll have the GitHub info. 🎉
If you are using GitHub Enterprise Server, you can configure @changesets/get-github-info to point at it using the following
environment variables:
GITHUB_SERVER_URL=https://github.example.com
GITHUB_GRAPHQL_URL=https://github.example.com/api/graphqlWhen using GitHub Actions, these environment variables will already have been set.
andarist
mateuszburzynski@gmail.com