A CLI to export GitHub contributions and publish to a GitHub Gist.
npm install gh-contrib-export[![npm version][npm-version-src]][npm-version-href]
[![JSDocs][jsdocs-src]][jsdocs-href]
[![License][license-src]][license-href]
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.

Run the tool locally to export your contributions:
``bash
export GH_PAT=your_github_token
$3
> [!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:
`yaml
.github/workflows/sync-contributions.yml
name: Sync Contributionson:
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_PAT as a repository secret (your GitHub Personal Access Token)
- Add GIST_ID as a repository secret (the ID of your Gist containing contributions.json`)MIT License © jinghaihan
[npm-version-src]: https://img.shields.io/npm/v/gh-contrib-export?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/gh-contrib-export
[npm-downloads-src]: https://img.shields.io/npm/dm/gh-contrib-export?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/gh-contrib-export
[bundle-src]: https://img.shields.io/bundlephobia/minzip/gh-contrib-export?style=flat&colorA=080f12&colorB=1fa669&label=minzip
[bundle-href]: https://bundlephobia.com/result?p=gh-contrib-export
[license-src]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat&colorA=080f12&colorB=1fa669
[license-href]: https://github.com/jinghaihan/gh-contrib-export/LICENSE
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
[jsdocs-href]: https://www.jsdocs.io/package/gh-contrib-export