GitHub PR Contributor Sorter
A browser extension that helps you prioritize GitHub pull requests by sorting them based on contributor status, making it easier to spot and review contributions from new contributors who might need extra attention.
Features
- ๐ Identify New Contributors: Automatically detects first-time contributors to your repository
- ๐ Sort by Experience: Sort PRs to prioritize new or existing contributors
- ๐ฅ Visual Indicators: Adds badges to PRs showing contributor status
- ๐ฏ Smart Filtering: Uses GitHub's
author_association field for accurate contributor classification
- ๐ Dark Mode Support: Works seamlessly with GitHub's dark theme
- ๐พ Persistent Settings: Remembers your sorting preferences
- ๐ GitHub Token Support: Add your personal access token for unlimited API requests
- โก GraphQL Batch Fetching: Efficiently fetches multiple PRs in a single request when authenticated
- ๐ Smart Caching: Persistent caching reduces redundant API calls and improves performance
Installation
From Source (Developer Mode)
-
Download the Extension
git clone <repository-url>
cd sortPR
-
Load in Chrome/Edge
- Open Chrome/Edge and go to
chrome://extensions/
- Enable "Developer mode" (toggle in top right)
- Click "Load unpacked"
- Select the
sortPR folder
-
Load in Firefox
- Open Firefox and go to
about:debugging
- Click "This Firefox"
- Click "Load Temporary Add-on"
- Select the
manifest.json file
Usage
-
Navigate to GitHub: Go to any GitHub repository's pull requests page (e.g., https://github.com/owner/repo/pulls)
-
Configure GitHub Token (Recommended):
- Click the extension icon to open the popup
- Add your GitHub personal access token for unlimited requests
- Without a token: Limited to 60 API requests/hour, processes up to 10 PRs
- With a token: Unlimited requests, processes up to 50 PRs with GraphQL batch fetching
-
Sort PRs: Click one of the sorting options:
- ๐ New Contributors First: Prioritizes PRs from first-time contributors
- ๐ Existing Contributors First: Shows experienced contributors first
- ๐ Default Order: Restores GitHub's original sorting
-
View Contributor Badges: Each PR will show a badge indicating whether the author is a new or existing contributor
Extension Structure
sortPR/
โโโ manifest.json # Extension manifest
โโโ content.js # Main functionality (injected into GitHub pages)
โโโ popup.html # Extension popup interface
โโโ popup.js # Popup functionality
โโโ background.js # Background service worker
โโโ styles.css # Styling for the extension UI
โโโ icons/ # Extension icons
โ โโโ icon-generator.html # To generate icons
โ โโโ icon16.png
โ โโโ icon32.png
โ โโโ icon48.png
โ โโโ icon128.png
โโโ README.md
API Usage
The extension intelligently uses both GitHub's REST and GraphQL APIs:
Without Token (Rate Limited)
GET https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}
- Limited to 60 requests/hour
- Processes up to 10 PRs
- Individual REST API calls
With Token (Unlimited)
POST https://api.github.com/graphql
- Unlimited requests
- Processes up to 50 PRs
- Batch GraphQL queries for efficiency
- Falls back to REST API if needed
Required Token Scopes: public_repo for accessing public repository data
Caching: Smart caching system stores PR data for 30 minutes to minimize API usage
Privacy & Permissions
- No Personal Data Collection: The extension only reads publicly available PR data
- Local Storage Only: Settings are stored locally in your browser
- GitHub API Access: Uses GitHub's public API to fetch PR contributor information
- Active Tab Permission: Required to interact with GitHub pages
- Storage Permission: Used to save your sorting preferences
Browser Support
- โ
Chrome/Chromium (Manifest V3)
- โ
Microsoft Edge (Manifest V3)
- โ
Firefox (with minor compatibility)
Development
Testing Locally
- Make changes to the source files
- Go to
chrome://extensions/
- Click the reload button for the extension
- Refresh any GitHub PR pages to see changes
Key Files
content.js: Main logic for detecting PRs, fetching data, and sorting
popup.html/js: Extension popup interface and settings
background.js: Service worker for handling extension lifecycle
styles.css: All styling including dark mode support
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Troubleshooting
Extension Not Working
- Make sure you're on a GitHub repository's pull requests page
- Check that the extension is enabled in your browser
- Look for any console errors in the browser's developer tools
API Rate Limiting
- Without a token: Limited to 60 requests per hour, processes up to 10 PRs
- With a GitHub token: Unlimited requests, processes up to 50 PRs using GraphQL for efficient batch fetching
- Add your token in the extension popup for the best experience
License
MIT License - Feel free to use and modify as needed.
Support
If you encounter any issues or have feature requests, please open an issue on the project repository.