Skip to content

Latest commit

 

History

History
98 lines (80 loc) · 3.47 KB

File metadata and controls

98 lines (80 loc) · 3.47 KB

Chrome Extension Summary

Overview

This Chrome extension adds two useful features to GitHub pull request pages:

Feature 1: Copy PR Link Button

  • Location: Next to the PR title
  • Action: Copies PR title and URL to clipboard in format: PR Title: https://link-to-pr
  • Feedback: Shows "Copied!" with green checkmark on success, "Failed" with error icon on failure
  • Works on: All PR pages (draft, open, closed, merged)

Feature 2: Request Copilot Review Button

  • Location: Next to the Copilot reviewer link (/apps/copilot-pull-request-reviewer)
  • Action: Automates requesting a review from Copilot
  • Feedback: Shows "Requested!" on success, or helpful message if manual action needed
  • Works on: Only draft PRs (button only appears when PR has "Draft" status)

Technical Implementation

Files Created

  1. manifest.json - Chrome Extension Manifest V3 configuration

    • Permissions: clipboardWrite
    • Content scripts: Runs on GitHub PR pages (https://github.com/*/*/pull/*)
    • Icons: 16x16, 48x48, 128x128 PNG files
  2. content.js - Main content script (220+ lines)

    • Implements both features with proper error handling
    • Uses MutationObserver to handle dynamic content loading
    • Provides visual feedback for all actions
    • No external dependencies
  3. Icon files (icon16.png, icon48.png, icon128.png)

    • Simple branded icons for the extension
  4. test.html - Local test page

    • Simulates GitHub PR page structure
    • Allows testing without real GitHub access
    • Includes automatic detection of extension features
  5. TESTING.md - Comprehensive testing guide

    • Installation instructions
    • Feature testing scenarios
    • Troubleshooting guide
    • Debugging tips
  6. README.md - User documentation

    • Feature descriptions
    • Installation steps
    • Usage instructions
    • Development guidelines

Key Design Decisions

  1. Minimal Permissions: Only requests clipboardWrite permission
  2. No External Dependencies: Pure JavaScript, no libraries
  3. GitHub Theme Integration: Uses GitHub's button classes and color scheme
  4. Robust Error Handling: Graceful fallbacks and clear error messages
  5. Visual Feedback: All actions provide immediate visual confirmation
  6. Dynamic Content Support: Handles GitHub's AJAX page updates
  7. Manifest V3: Uses latest Chrome extension standard

Security

  • ✅ CodeQL scan completed with 0 vulnerabilities
  • ✅ No sensitive data access
  • ✅ Scoped to GitHub PR pages only
  • ✅ No network requests
  • ✅ No background scripts

Browser Compatibility

  • ✅ Chrome (primary target)
  • ✅ Microsoft Edge (Chromium)
  • ✅ Brave (Chromium)
  • ✅ Other Chromium-based browsers

Installation Size

  • Total: ~20 KB
  • Code: ~15 KB (manifest.json + content.js)
  • Icons: ~5 KB (3 PNG files)

Testing Strategy

  1. Local HTML test page for initial validation
  2. Manual testing on actual GitHub PR pages
  3. Test both draft and non-draft PRs
  4. Verify clipboard functionality
  5. Check visual feedback and error handling

Future Enhancements (Optional)

  • Add options page for customization
  • Support for GitHub Enterprise
  • Keyboard shortcuts
  • More copy format options
  • Additional reviewer automation features

Notes

  • The "Request Review" feature attempts to automate UI interactions
  • GitHub may change their DOM structure, requiring selector updates
  • Extension provides helpful messages when automation isn't possible
  • Users can always fall back to manual review requests