My Badges
My Badges is a GitHub Action that generates badges for your profile README.md. Badges will be updated automatically every day. And you will get new badges as you progress, or as community adds new badges. Yes, you can add your own badges!
Usage
- In the repository, create a
.github/workflows/
directory. - Add
my-badges.yml
file with the following content:
yaml
name: my-badges
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
permissions:
contents: write
jobs:
my-badges:
runs-on: ubuntu-latest
steps:
- name: Update My Badges
run: npx update-my-badges ${{github.repository_owner}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- In your repository, create or edit the
README.md
file to include:
markdown
## My Badges
<!-- my-badges start -->
<!-- my-badges end -->
Parameters
Click to show/close parameters
Name | Type | Required | Default | Description | More Description |
---|---|---|---|---|---|
env.GITHUB_TOKEN | string | GitHub Token | The workflow will use a default runner token. | ||
env.GITHUB_USER | string | GitHub Username | |||
env.GITHUB_REPO | string | {user/user} | Repository name to push badges. | ||
data | string | Path to JSON to generate badges. | If empty, required data will be obtained from the GH API. | ||
size | number | 64 | Badge size for README.md, px. | ||
dryrun | boolean | Generate badges, but skip pushing them to git. | |||
pick | string | List of badges to pick. | Pass --pick="a-commit,ab-commit,revert-revert-commit" to generate only the specified entries. If empty gets all of them. | ||
omit | string | List of badges to exclude. | For example, if you're too shy to flex your stars: --omit:stars-100,stars-500,stars-1000 or even shorter --omit:stars-* . | ||
compact | boolean | Represent the highest tier badges in README.md. | For example, If you have both stars-100 and stars-500 achievements, only the last one will be shown. |
Examples
markdown
<!-- my-badges start -->
<h4><a href="https://github.com/my-badges/my-badges">My Badges</a></h4>
<a href="my-badges/github-anniversary-10.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/github-anniversary/github-anniversary-10.png?raw=true" alt="I joined GitHub 10 years ago." title="I joined GitHub 10 years ago." width="64"></a>
<a href="my-badges/evening-commits.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/time-of-commit/evening-commits.png?raw=true" alt="I commit in the evening." title="I commit in the evening." width="64"></a>
<a href="my-badges/my-badges-contributor.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/my-badges-contributor/my-badges-contributor.png?raw=true" alt="I contributed to <a href="https://github.com/my-badges/my-badges">My Badges</a>!" title="I contributed to <a href="https://github.com/my-badges/my-badges">My Badges</a>!" width="64"></a>
<a href="my-badges/the-ultimate-question.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/the-ultimate-question/the-ultimate-question.png?raw=true" alt="I found the answer to the ultimate question of life, the universe, and everything!" title="I found the answer to the ultimate question of life, the universe, and everything!" width="64"></a>
<a href="my-badges/mass-delete-commit-10k.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/mass-delete-commit/mass-delete-commit-10k.png?raw=true" alt="When I delete code, I delete a lot." title="When I delete code, I delete a lot." width="64"></a>
<a href="my-badges/ab-commit.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/abc-commit/ab-commit.png?raw=true" alt="One of my commit sha starts with "ab"." title="One of my commit sha starts with "ab"." width="64"></a>
<a href="my-badges/morning-commits.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/time-of-commit/morning-commits.png?raw=true" alt="I commit in the morning." title="I commit in the morning." width="64"></a>
<a href="my-badges/old-issue-3.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/old-issue/old-issue-3.png?raw=true" alt="I closed an issue that was open for 3 years" title="I closed an issue that was open for 3 years" width="64"></a>
<a href="my-badges/pr-collaboration-10.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/pr-collaboration/pr-collaboration-10.png?raw=true" alt="I have participated in pull requests with 10 or more people" title="I have participated in pull requests with 10 or more people" width="64"></a>
<a href="my-badges/fix-5.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/fix-commit/fix-5.png?raw=true" alt="I did 5 sequential fixes." title="I did 5 sequential fixes." width="64"></a>
<a href="my-badges/stars-1000.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/stars/stars-1000.png?raw=true" alt="I collected 1000 stars." title="I collected 1000 stars." width="64"></a>
<a href="my-badges/dead-commit.md"><img src="https://github.com/my-badges/my-badges/blob/master/src/all-badges/dead-commit/dead-commit.png?raw=true" alt="I pushed a commit with "dead" 4 times." title="I pushed a commit with "dead" 4 times." width="64"></a>
<!-- my-badges end -->