github-activity-box

0.1.5 • Public • Published

⚡️📌 Update a pinned gist to show your latest GitHub activity

Originally from JasonEtco/activity-box.

github-activity-box

npm GitHub Workflow Status Checked with Biome License

✨ Enhancements

  • 🔍 Uses GraphQL API to search for issues and PRs authored by the provided username.
  • 🎨 Supports custom descriptions and filtering by specific repos/owners
  • ✅ Updated dependencies, rewritten to TypeScript, and refactored the tests.
  • 📦 Published to npm with binary support for easy use via npx or pnpx

[!NOTE]

The original implementation fetched events initiated by the user (so PRs merged by others aren't counted).

Currently, multiple states of the same PR, such as opening and merging, won't be retrieved. Also, comment events are not included.

🚀 Usage

Use as a CLI

# Run directly with npx/pnpx
npx github-activity-box [options]

# Or install globally
npm install -g github-activity-box
github-activity-box [options]

Options:

  • --dry - Preview output without updating the gist

Required Environment Variables:

Variable Description
GIST_ID ID portion from your gist URL (https://gist.github.com/username/GIST_ID)
GH_PAT GitHub personal access token with gist scope
GH_USERNAME Your GitHub username
DESCRIPTION (Optional) Description for the gist
EXCLUDE_REPO (Optional) Comma-separated list of repositories to exclude
Example: username/repo1,username/repo2
EXCLUDE_OWNER (Optional) Comma-separated list of owners to exclude
Example: username1,username2
ACTIVITY_TYPE (Optional) Type of activities to display: all (default), issue, or pr

GitHub Action Setup

Prerequisites

  1. Create a new public GitHub Gist
  2. Generate a personal access token with gist scope

Workflow Configuration

Create .github/workflows/activity-box.yml:

name: Activity Box
on:
  workflow_dispatch:
  schedule:
    - cron: '*/30 * * * *'  # Updates every 30 minutes

jobs:
  update-activity:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install pnpm
        uses: pnpm/action-setup@v4
        with:
          version: 10
          run_install: false

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: pnpm

      - name: Update activity
        run: npx github-activity-box@0
        env:
          GH_PAT: ${{ secrets.GH_PAT }}
          GH_USERNAME: your-username
          GIST_ID: your-gist-id
          # You can also use hardcoded values instead of variables
          # EXCLUDE_OWNER: username1,username2
          # EXCLUDE_REPO: username/repo1,username/repo2
          EXCLUDE_OWNER: ${{ vars.EXCLUDE_OWNER }}
          EXCLUDE_REPO: ${{ vars.EXCLUDE_REPO }}
          DESCRIPTION: Your custom description

Add Repository Secrets and Variables

  1. Go to your repository Settings > Secrets and variables > Actions.
  2. Add a repository secret:
    • GH_PAT: Your GitHub access token (requires gist scope).
  3. (Optional) Add repository variables as needed (EXCLUDE_OWNER, EXCLUDE_REPO).

Inspired by matchai/bird-box and forked from JasonEtco/activity-box

Readme

Keywords

none

Package Sidebar

Install

npm i github-activity-box

Weekly Downloads

58

Version

0.1.5

License

ISC

Unpacked Size

12.6 kB

Total Files

5

Last publish

Collaborators

  • max3917