gh-contrib-export
v0.0.0-alpha.0
Published
A CLI to export GitHub contributions and publish to a GitHub Gist.
Maintainers
Readme
GitHub Contributions Export
A CLI tool to export your GitHub contributions (Pull Requests) and publish to a GitHub Gist. Automatically sync your contribution data to a Gist for easy sharing and tracking.
Usage
Local usage
Run the tool locally to export your contributions:
export GH_PAT=your_github_token
# Export to local file
npx gh-contrib-export
# Export and update Gist
npx gh-contrib-export --gist-id idGitHub CI usage
[!IMPORTANT] Your Gist must already exist and contain a file named
contributions.json. The tool will update this file with your latest contributions. If the file doesn't exist, the tool will throw an error.
Set up GitHub Actions to automatically sync your contributions on a schedule:
# .github/workflows/sync-contributions.yml
name: Sync Contributions
on:
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC
workflow_dispatch: # Allow manual trigger
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Set node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Export and Update Gist
run: npx gh-contrib-export
env:
GH_PAT: ${{ secrets.GH_PAT }}
GIST_ID: ${{ secrets.GIST_ID }}Configure secrets in your repository:
- Go to your repository Settings > Secrets and variables > Actions
- Add
GH_PATas a repository secret (your GitHub Personal Access Token) - Add
GIST_IDas a repository secret (the ID of your Gist containingcontributions.json)
License
MIT License © jinghaihan
