Giter VIP home page Giter VIP logo

all-contributors-for-repository's Introduction

All Contributors For Repository

Generates an allcontributors list for an existing repository. ๐Ÿค

All Contributors: 1 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

Josh Goldberg
Josh Goldberg

๐Ÿ”ง ๐Ÿ› ๐Ÿ’ป ๐Ÿšง ๐Ÿ‘€ ๐Ÿ“– ๐Ÿš‡ โš ๏ธ

๐Ÿ’™ This package is based on @JoshuaKGoldberg's create-typescript-app.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.