Automatically generate beautiful SVG badges for your GitHub open source contributions
Showcase your open source contributions with stunning, auto-updating badges on your GitHub profile. This action wraps the gh-oss-stats CLI tool to generate SVG badges that display your contributions to external repositories.
- 36 badge combinations: 6 themes × 2 variants × 3 styles
- Auto-commit: Automatically updates your profile badge on schedule
- Highly customizable: Filter by stars, limit repos, exclude organizations
- Zero configuration: Works out-of-the-box with sensible defaults
- Fast: Efficient GitHub API usage with smart rate limit handling
Step 1: Create .github/workflows/oss-badge.yml in your profile repository:
name: Generate OSS Badge
on:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday at midnight
workflow_dispatch: # Manual trigger
permissions:
contents: write # Required for auto-commit
jobs:
update-badge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate OSS Badge
uses: mabd-dev/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
badge-style: summary
badge-theme: darkStep 2: Add the badge to your README.md:
That's it! Your badge will auto-update weekly.
- uses: mabd-dev/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}- uses: mabd-dev/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
badge-style: detailed
badge-theme: nord
badge-variant: text-based
badge-limit: 10- uses: mabd-dev/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
min-stars: 500 # Only repos with 500+ stars
badge-sort: stars # Sort by most popular
badge-limit: 5 # Top 5 repos- uses: mabd-dev/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
exclude-orgs: "my-company,client-org,acme-corp"
badge-style: summary- name: Fetch OSS Stats
id: stats
uses: mabd-dev/[email protected]
with:
mode: fetch
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Summary Badge
uses: mabd-dev/[email protected]
with:
mode: badge
data: ${{ steps.stats.outputs.json }}
github-token: ${{ secrets.GITHUB_TOKEN }}
badge-style: summary
output-path: oss-badge-dark.svg
- name: Generate Detailed Badge
uses: mabd-dev/[email protected]
with:
mode: badge
data: ${{ steps.stats.outputs.json }}
github-token: ${{ secrets.GITHUB_TOKEN }}
badge-style: detailed
output-path: oss-badge-dark.svg- uses: actions/checkout@v4
- name: Generate Badge
uses: mabd-dev/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-commit: false # Don't auto-commit
- name: Custom Commit Logic
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add oss-badge.svg
git commit -m "feat: update OSS badge [skip ci]"
git pushProblem: Workflow runs but badge doesn't change.
Solution:
- Check if workflow has
contents: writepermission:jobs: update-badge: runs-on: ubuntu-latest permissions: contents: write
- Verify
commit-badge: true(default) - Check GitHub Actions logs for errors
Problem: Error: API rate limit exceeded
Solution:
- Use a Personal Access Token instead of
GITHUB_TOKEN:github-token: ${{ secrets.PAT }}
- Reduce
max-prsor increase schedule interval - Enable
verbose: trueto see rate limit status
Problem: Badge shows "0 projects"
Solution:
- Check if you have merged PRs to external repos
- Verify
exclude-orgsisn't too broad - Lower
min-starsthreshold - Ensure username is correct (defaults to
${{ github.actor }})
A: Weekly is recommended for most users. Daily updates may hit rate limits; monthly is fine for infrequent contributors.
on:
schedule:
- cron: '0 0 * * 0' # Weekly (Sunday midnight)
# - cron: '0 0 * * *' # Daily
# - cron: '0 0 1 * *' # MonthlyA: The action itself runs fine in private repos, but it only tracks contributions to public repositories (GitHub API limitation).
A: Currently, customization is limited to the 6 themes and 2 variants. Full custom styling requires forking and modifying the badge generation templates. Open an issue if you need specific customization.
A: Any merged PR to a repository you don't own. Repos owned by excluded orgs (via exclude-orgs) are also filtered out.
A: Set verbose: true to enable detailed logging:
- uses: mabd-dev/[email protected]
with:
verbose: trueCheck the Actions logs for detailed API calls and processing steps.
- Main Repository: github.com/mabd-dev/gh-oss-stats
- CLI Documentation: gh-oss-stats README
- Issue Tracker: Report a bug
- Changelog: Release notes
Contributions are welcome! Here's how you can help: