package
Predict the next pull request number for a GitHub repository
npm install next-prGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
5.1 kB
Includes dependencies.
Predict the next pull request number for a GitHub repository.
Useful when you need a PR's number before it exists; for example, to reference it in a changelog entry that ships with the PR itself.
$ npx next-pr nodejs/node
58124Full GitHub URLs and .git suffixes work too:
$ npx next-pr https://github.com/nodejs/node.git
58124Unauthenticated requests are limited to 60 per hour by GitHub. Set a
GITHUB_TOKEN environment variable to raise the limit (any token with public
repo read access works, including the automatic token in GitHub Actions):
$ GITHUB_TOKEN=ghp_... npx next-pr nodejs/node$ npm install next-primport { nextPrNumber } from "next-pr";
const number = await nextPrNumber("nodejs/node");
// or: await nextPrNumber("https://github.com/nodejs/node")
console.log(number); // e.g. 58124nextPrNumber(repo, options?)repo: a owner/repo slug or a github.com URL.options.token: GitHub API token. Defaults to process.env.GITHUB_TOKEN.Returns a Promise<number>. Rejects with an Error if the repo slug is
malformed or the GitHub API returns a non-2xx response (e.g. an unknown repo
or a hit rate limit).
parseRepo(input)The slug/URL parser used internally, exported for convenience. Returns
{ owner, repo } or throws on invalid input.
The result is a prediction, not a reservation: if someone opens an issue or PR between the lookup and your PR, the number will be off by however many landed in between.