Socket
Socket
Sign inDemoInstall

all-contributors-for-repository

Package Overview
Dependencies
69
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    all-contributors-for-repository

Generates an allcontributors list for an existing repository. 🤝


Version published
Maintainers
1
Install size
57.5 MB
Created

Changelog

Source

0.2.2 (2024-01-12)

Bug Fixes

  • bumped packages to latest (#217) (da1cabe), closes #216

Readme

Source

All Contributors For Repository

Generates an allcontributors list for an existing repository. 🤝

All Contributors: 2 Codecov Test Coverage Contributor Covenant License: MIT Sponsor: On GitHub Style: Prettier TypeScript: Strict npm package version Sponsor: On GitHub

✨ See this tool in action with all-contributors-auto-action! ✨

Usage

npm i all-contributors-for-repository
import { getAllContributorsForRepository } from "all-contributors-for-repository";

const contributors = await getAllContributorsForRepository({
	owner: "JoshuaKGoldberg",
	repo: "template-typescript-node-package",
});

/*
{
  john_reilly: [ 'bug', 'code' ],
  joshuakgoldberg: [ 'maintenance', 'tool' ],
}
*/
console.log(contributors);

Warning This tool only sees contributions that can be detected from the last 500 events in GitHub's API. Don't forget to manually add in other forms of contributions!

The types of contributions detected from the GitHub API are:

  • 🐛 bug: anybody who filed an issue labeled as accepting PRs and a bug (see Options)
  • 📖 doc: authors of merged PRs that address issues labeled as accepting PRs and docs (see Options)
  • 🚧 maintenance: adding labels to issues and PRs, and merging PRs
  • 👀 review: submitting a review for a PR
  • 🔧 tool: authors of merged PRs that address issues labeled as accepting PRs and tooling (see Options)

Additionally, based on PR conventional commit titles in the Angular convention, for all PR authors and co-authors:

  • build and ci: will be treated as an :infra: contribution
  • docs: will be treated as an :doc: contribution
  • test: will be treated as an :test: contribution
  • All other PRs -including those without a conventional title- will be treated as :code: contributions

💡 Given that list of contributors, you might want to run all-contributors add on each contributor & contribution type.

import { $ } from "execa";

for (const [contributor, contributions] of Object.entries(contributors)) {
	const contributionTypes = Object.keys(contributions).join(",");
	await $`npx all-contributors add ${contributor} ${contributionTypes}`;
}

Options

The exported getAllContributorsForRepository function takes in an object with two required properties:

  • owner (string): The owner of the repository to query, such as "JoshuaKGoldberg".
  • repository (string): The name of the repository to query, such as "all-contributors-for-repository".

It additionally allows for the following optional options.

  • auth (string): GitHub auth token to query the API with, if necessary for private repositories and/or to avoid rate limiting.
  • ignoredLogins (string[]): Usernames to ignore commits from, such as bot and bot-like users.
    • Default: "allcontributors", "allcontributors[bot]", "dependabot", "dependabot[bot]", "renovate", "renovate[bot]"
  • labelAcceptingPrs (string): Label to indicate an issue is accepting pull requests.
  • labelTypeBug (string): Label to indicate an issue is for a bug.
  • labelTypeDocs (string): Label to indicate an issue is for documentation.
  • labelTypeTool (string): Label to indicate an issue is for tooling.
import { getAllContributorsForRepository } from "all-contributors-for-repository";

getAllContributorsForRepository({
	auth: "abc123",
	ignoredLogins: ["MyBotLikeUser"],
	labelAcceptingPrs: "help wanted",
	labelTypeBug: "bug",
	labelTypeDocs: "docs",
	labelTypeTool: "tool",
});

Development

See .github/CONTRIBUTING.md, then .github/DEVELOPMENT.md. Thanks! 💖

Contributors

Fabian De La Peña Montero
Fabian De La Peña Montero

📖
Josh Goldberg
Josh Goldberg

🔧 🐛 💻 🚧 👀 📖 🚇 ⚠️

💙 This package is based on @JoshuaKGoldberg's create-typescript-app.

FAQs

Last updated on 12 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc