⭐️ a minimal but inclusive github stats badge ⭐️
This is a GitHub Action that generated a stats badge that you can use on your GitHub profile page.
Why this stats badge generator you say? Because I noticed that people creating repos under organizations and receiving stars did not count towards their stars in most badge generation tools. And that's just a pity. So, in comes github-stats-card
, a minimal but inclusive GitHub stats badge generator.
The badge generator set up to works as a GitHub action. You can add it to the GH Actions workflow of your profile page as a step. Below an example workflow yaml.
name: generate badge
on:
workflow_dispatch:
push:
schedule:
- cron: '0 0 * * 0'
jobs:
update:
name: Update stats card
runs-on: ubuntu-latest
steps:
- uses: datarootsio/github-stats-card@v1
with:
username: bart6114
gh_token_stats: ${{ secrets.GH_PAT }}
gh_token_commits: ${{ secrets.GITHUB_TOKEN }}
badge_path: assets/badge.svg
header: "👋 hi i'm"
about: "Loves goblins, despises gnomes.\nEnjoys candlelit custard pudding."
theme: dark
commit_message: Badge generated by the treadmill bunnies.
If the workflow has succesfully ran, it will create a badge under assets/badge.svg
. That you can then include in your readme via ![ain't it a beaut](assets/badge.svg)
.
The following themes are available, see configuration options on how to specify theme.
Want to create your own themes? Check out the themes/
folder, it rather straightforward. PRs are very much welcome! ❤️
theme: dark
👇 (default theme)
theme: cool-lake
👇
theme: neko-sleeps
👇
theme: jimmy-goes-fishing
👇
theme: pad-and-paper
👇
theme: retro-print
👇
theme: terminal-green
👇
theme: tropical-sunset
👇
theme: a-colibri-hums-while-the-dog-farts
👇
theme: grainy-dreams
👇
theme: hypnotoad
👇
gh_token_stats
: token used for fetching user stats, typically a personal access token (PAT) with access to your personal and organisation repos
gh_token_commits
: [optional] if you set this to ${{ secrets.GITHUB_TOKEN }}
it will use the github actions bot to commit the svg to the repo (if not set it will use your PAT)
badge_path
: [optional] path of badge svg (defaults to assets/badge.svg
)
username
: your username
header
: [optional] header to use for badge (defaults to: 👋 hi i'm
)
about
: about me description to use for badge (use \n for newlines)
commit_message
: [optional] commit message to use (defaults to Update badge
)
commit
: [optional] whether to commit badge to repo (defaults to true
)
exclude_repos
: [optional] comma separated list of repos to exclude from stats, will do regex based matching (e.g. 'datarootsio' will match all repos in dataroots, 'datarootsio/databooks' will only match a single repo)
exclude_repos_override
: [optional] comma separated list of repos to override from exclusion list (e.g. 'datarootsio' in exclude_repos and 'datarootsio/databooks' in exclude_repos_override will ONLY include databooks in stats)
theme
: [optional] see themes for options
-
Which repositories count towards my stargazers count?
Check out the logs of your action run. It will log which repositories are included after the exclude and override filters have been applied.
-
How do I refresh the badge?
You probably want to look into the
schedule
event trigger. It allows you to use a cron-based schedule that allows you to for example refresh your badge daily.