npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gh-accept-invites

v1.0.0

Published

Accept all pending GitHub repository invitations from a specific owner

Readme

gh-accept-invites

Accept all pending repository invitations from a specific owner. Zero runtime dependencies — uses native fetch.

Use case

You received repository invitations from a machine user account and want to accept them all at once. Perhaps someone used gh-invite-all to send hundreds of invitations — this tool lets you accept them in bulk.

Requirements

  • Node.js >= 18
  • A GitHub personal access token (PAT) — see below

Token setup

Classic PAT (recommended) — narrowest scope:

  1. Create a classic token
  2. Select only the repo:invite scope
  3. Export it: export GITHUB_TOKEN="ghp_..."

Fine-grained PAT — requires broader permissions:

  1. Create a fine-grained token
  2. Grant Administration: Read and Write on target repositories
  3. Export it: export GITHUB_TOKEN="github_pat_..."

Why classic? The repo:invite scope grants access to invitations only. Fine-grained tokens have no equivalent — they require "Administration", which also covers repository settings, webhooks, environments, and more.

Install

npm install -g gh-accept-invites

Usage

export GITHUB_TOKEN="ghp_..."

# List all pending invitations
gh-accept-invites --list

# Accept all invitations from a specific owner
gh-accept-invites <owner>

Output

List mode:

Pending invitations:

  machine-user (3 invites)
    repo-1
    repo-2
    repo-3

  other-owner (1 invite)
    some-repo

2 expired invitations not shown.

Accept mode:

  ✓ machine-user/repo-1 — accepted
  ✓ machine-user/repo-2 — accepted
  ✗ machine-user/repo-3 — error: HTTP 403 Forbidden

Done. 2 accepted, 1 errors. 1 expired invitation skipped.

Expired invitations (invitations past their 7-day GitHub expiry) are automatically filtered out. When expired invitations exist, the count is shown in the output.

API

The core logic is also available as a library:

import { acceptInvites, listInvites } from "gh-accept-invites";

// Accept all invitations from an owner
const { results, expiredCount } = await acceptInvites({
  token: process.env.GITHUB_TOKEN!,
  owner: "machine-user",
});

// List all pending invitations
const { invitations, expiredCount } = await listInvites({
  token: process.env.GITHUB_TOKEN!,
});

Each result has { repo, owner, status, error? } where status is one of:

  • "accepted" — invitation accepted
  • "error" — failed (see error field)

Development

git clone <repo-url>
cd gh-accept-invites
npm install
npm run build

Run the CLI locally:

npm start -- <owner>

Run tests:

npm test

License

BSD 3-Clause. See LICENSE.