Przejdź do głównej zawartości

Using the All Contributors CLI

You will mostly use four commands:

Command What it does
init Prepare a project to use the CLI
add Add a contributor or update their contribution types
check Find contributors who are not yet acknowledged
generate Regenerate the contributor tables and badge

You can run all-contributors init when you first start using the All Contributors CLI. This command asks you a few questions and then sets up the project to support All Contributors.

Okno terminala
npx all-contributors init

The setup includes creating:

  • an .all-contributorsrc configuration file and
  • a contributor table in the files you specify.

The default file for the contributor table is your README.md.

Use the add command to add:

  • new contributors to your project, or
  • new ways in which they have contributed.

If you run add without a username, the CLI asks who to add and which contribution types to record.

Okno terminala
npx all-contributors add
? What is the contributor's GitHub username? lwasser
? What are the contribution types? 💻 Code, 📖 Documentation

If you pass a username and one or more contribution types, the CLI adds that person without those prompts. For instance, someone may already be credited for code, and you later want to credit a documentation pull request too. The contributor is updated in your configuration file, and the contributors file is updated just as if you used the generate command.

Okno terminala
# Add new contributor <username>, who made a contribution of type <contribution>
npx all-contributors add <username> <contribution>
# Example:
npx all-contributors add jfmengels code,doc

Where username is the user’s GitHub or Gitlab username, and contribution is a ,-separated list of contributions. See the Emoji Key (Contribution Types Reference) for a list of valid contribution types.

Use check to compare people who have commits on GitHub or GitLab with the ones credited in your .all-contributorsrc file.

The command prints two lists when it finds a mismatch: people who have commits but are missing from .all-contributorsrc, and people credited for code or tests who have no matching commits.

Missing contributors in .all-contributorsrc:
octocat
Unknown contributors found in .all-contributorsrc:
ghost
Okno terminala
npx all-contributors check

Use generate to read the contributors list from your .all-contributorsrc file and update the contributor tables specified by the files key.

Okno terminala
npx all-contributors generate

Zwróć uwagę, że musi mieć możliwość znalezienia tagów w odpowiedniej kolejności, aby zaktualizować tabelę:

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- ALL-CONTRIBUTORS-LIST:END -->

Pamiętaj też, że musi znaleźć następujące tagi, aby zaktualizować odznakę:

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
<!-- ALL-CONTRIBUTORS-BADGE:END -->

In some cases you may see the error message GitHub API rate limit exceeded for xxx. You may need to set an environment variable named PRIVATE_TOKEN to circumvent this GitHub rate limit.

Prywatny token to osobisty token dostępu (Personal Access Token - PAT) służący do uwierzytelniania za pomocą interfejsu API GitHub.

Please note that if you are using a self-hosted GitLab instance, If you are using a private repository, a self-hosted GitLab instance, or encounter rate limits on GitLab.com, set an environment variable named PRIVATE_TOKEN.

Okno terminala
# ustaw prywatny token na Linux
export PRIVATE_TOKEN=your_private_token
# ustaw prywatny token na Windows
set PRIVATE_TOKEN=your_private_token