Automatically mark GitHub threads as "done" when they don't require any action from you. This tool helps reduce thread noise from being part of multiple organizations and teams.
- Smart Filtering: Automatically identifies threads that don't require action
- PR Management: Marks merged/closed PR threads as done when you're not directly involved
- Scheduled Processing: Runs automatically via GitHub Actions
- Configurable: Easy to add new filtering rules
- Logging: Comprehensive logging for debugging and monitoring
- Pull Request Threads: Marks as done if the PR is already merged or closed AND you're not a direct reviewer (individual or team-based)
- Renovate PRs: Marks as done if the PR is opened by Renovate (renovate-sh-app or renovate[bot]) AND you're not a direct reviewer (individual or team-based)
git clone <your-repo-url>
cd gh-notifications
npm installCopy .env.example to .env and configure:
cp .env.example .envRequired variables:
GITHUB_TOKEN: Your GitHub Personal Access Token withnotifications:readandnotifications:writescopesGITHUB_USER: Your GitHub username
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click "Generate new token (classic)"
- Select scopes:
notifications:read- to read your threadsnotifications:write- to mark threads as done
- Copy the token and add it to your
.envfile
# Test your GitHub connection first
npm run cli -- test-connection -t YOUR_TOKEN -u YOUR_USERNAME
# Preview what would be marked as done (dry run)
npm run cli -- process -t YOUR_TOKEN -u YOUR_USERNAME --dry-run
# Actually process threads
npm run cli -- process -t YOUR_TOKEN -u YOUR_USERNAME
# With debug logging
npm run cli -- process -t YOUR_TOKEN -u YOUR_USERNAME --dry-run --log-level debug# Set up environment variables
export GITHUB_TOKEN=your_token_here
export GITHUB_USER=your_username
# Development mode
npm run dev
# Or build and run
npm run build
npm startAdd these secrets to your repository:
GITHUB_TOKEN: Your GitHub Personal Access Token (same as above)GITHUB_USER: Your GitHub username
The workflow is already configured to run every 6 hours. You can also trigger it manually from the Actions tab.
- Load User Teams: Fetches and caches your team memberships on startup (cached for 24 hours)
- Fetch Threads: Retrieves all unread GitHub threads
- Filter PR Threads: Identifies Pull Request threads
- Get PR Details: Fetches detailed information about each PR
- Apply Rules: Checks if the PR is merged/closed and if you're directly involved (individual or team-based)
- Mark as Done: Marks qualifying threads as done (or previews in dry-run mode)
The tool caches team memberships to improve performance and reduce API calls:
- Cache Location:
.cache/teams-{username}.json - Cache TTL: 24 hours (configurable)
- Cache Benefits: Faster startup, fewer API calls, better rate limit management
- Cache Invalidation: Use
--invalidate-cacheflag to force refresh
- When you're added to new teams
- When team memberships change
- When you suspect stale data
- Periodically (e.g., weekly) to ensure accuracy
npm run cli -- process -t <token> -u <username> [options]Options:
-t, --token <token>- GitHub Personal Access Token (required)-u, --user <username>- GitHub username (required)-d, --dry-run- Preview what would be marked as done without actually doing it-i, --invalidate-cache- Invalidate team cache and fetch fresh data-l, --log-level <level>- Log level: debug, info, warn, error (default: info)
Examples:
# Dry run to see what would be processed
npm run cli -- process -t ghp_xxx -u myusername --dry-run
# Actually process threads
npm run cli -- process -t ghp_xxx -u myusername
# Invalidate cache and fetch fresh team data
npm run cli -- process -t ghp_xxx -u myusername --invalidate-cache
# Debug mode to see detailed logs
npm run cli -- process -t ghp_xxx -u myusername --dry-run --log-level debugnpm run cli -- test-connection -t <token> -u <username> [options]Options:
-t, --token <token>- GitHub Personal Access Token (required)-u, --user <username>- GitHub username (required)-i, --invalidate-cache- Invalidate team cache and fetch fresh data-l, --log-level <level>- Log level: debug, info, warn, error (default: info)
Examples:
# Test your GitHub connection
npm run cli -- test-connection -t ghp_xxx -u myusername
# Test connection and refresh team cache
npm run cli -- test-connection -t ghp_xxx -u myusername --invalidate-cacheTo add new filtering rules, create a new filter class implementing the NotificationFilter interface:
export class MyCustomFilter implements NotificationFilter {
shouldMarkAsDone(notification: GitHubNotification, prDetails?: PullRequestDetails): boolean {
// Your filtering logic here
return false; // or true to mark as done
}
}Then add it to the CompositeFilter in notification-processor.ts.
npm run dev- Run in development mode with ts-nodenpm run build- Build TypeScript to JavaScriptnpm start- Run the built applicationnpm test- Run testsnpm run lint- Run ESLintnpm run lint:fix- Fix ESLint issues
src/
├── index.ts # Main entry point
├── types.ts # TypeScript type definitions
├── logger.ts # Logging utilities
├── github-client.ts # GitHub API client
├── notification-filters.ts # Filtering logic
└── notification-processor.ts # Main processing logic
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT