Перейти к содержимому

How to Fix a Stale Contributor Badge

The All Contributors badge shows how many people are listed in your project’s contributors table (the same people stored in the contributors list in .all-contributorsrc).

The Bot and the CLI write that contributor count into the badge URL as a fixed number (for example 13 below). If you edit .all-contributorsrc by hand, your badge stays stale until the Bot or CLI runs again.

The <!-- ALL-CONTRIBUTORS-BADGE:... --> comments are markers. They tell the Bot which lines to update, and it replaces everything between them on each run.

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

All Contributors

You can use a shields.io badge that reads the contributor count from .all-contributorsrc. Set badgeTemplate so the Bot writes that badge every time.

  1. Confirm the badge markers are in your README

    Make sure the ALL-CONTRIBUTORS-BADGE markers are in your README.md (or another file you list under files in .all-contributorsrc). The Bot only updates the badge between those markers.

  2. Set badgeTemplate in .all-contributorsrc

    Add a badgeTemplate with your GitHub owner and repository name. There are no placeholders, so you need to type them in yourself. This example uses this docs repository:

    {
    "badgeTemplate": "[![All Contributors](https://img.shields.io/github/all-contributors/all-contributors/allcontributors.org?color=ee8449&style=flat-square)](#contributors-)"
    }

    Swap all-contributors/allcontributors.org for your owner and repository. You can also change the color or style. See Change the badge color.

  3. Let the Bot or CLI run once

    The next time the Bot or CLI adds a contributor (or you run all-contributors generate), it writes the live badge between your markers:

    <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
    [![All Contributors](https://img.shields.io/github/all-contributors/all-contributors/allcontributors.org?color=ee8449&style=flat-square)](#contributors-)
    <!-- ALL-CONTRIBUTORS-BADGE:END -->

    All Contributors

    From then on, your badge stays in sync with .all-contributorsrc, including when you edit the list by hand.

shields.io reads .all-contributorsrc from your repository’s default branch, so the count only changes after you merge your edit. shields.io also caches badges, so the new count can take a short while to appear.

You can paste the live badge into your README and delete both marker comments if you don’t want the Bot editing that line. The contributor count still updates, because shields.io reads .all-contributorsrc. With no markers, the Bot leaves your badge markdown alone.