Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

Provides comprehensive GitHub App setup documentation and implements a webhook endpoint with JWT authentication to enable bot interactions with repositories.

Documentation

GITHUB_APP_SETUP.md - Complete setup guide covering:

  • GitHub App creation and configuration
  • Private key generation and security
  • Webhook URL setup with ngrok for local testing
  • Permission scoping (Issues, PRs, Contents)
  • Environment variable configuration
  • Troubleshooting common issues

Implementation

Webhook Endpoint (/aibot/webhook/)

  • HMAC-SHA256 signature verification for security
  • Event routing: ping, issue_comment, pull_request
  • CSRF-exempt with signature-based auth

GitHub App Authentication (aibot/github_utils.py)

  • JWT token generation using RSA private key
  • Installation access token management
  • API client for creating comments
  • Specific error messages for auth failures (401), missing installations (404), permission issues (403)

Ping/Pong Command

  • Responds to /ping in issue comments with "🏓 Pong! The GitHub App is working correctly."
  • Validates webhook flow end-to-end

Configuration

Environment variables required:

GITHUB_APP_ID=123456
GITHUB_APP_PRIVATE_KEY_PATH=/path/to/private-key.pem
GITHUB_WEBHOOK_SECRET=your-webhook-secret
GITHUB_APP_INSTALLATION_ID=7891011

Added *.pem to .gitignore to prevent private key leaks.

Testing

Example webhook payload handling:

# POST /aibot/webhook/
# Headers: X-GitHub-Event: issue_comment, X-Hub-Signature-256: sha256=...
{
  "action": "created",
  "comment": {"body": "/ping"},
  "issue": {"number": 123},
  "repository": {"name": "repo", "owner": {"login": "owner"}}
}
# Response: Creates comment "🏓 Pong! The GitHub App is working correctly."

6 unit tests covering signature validation, event routing, command processing, and error handling.

Original prompt

create instructions on how to setup a github app and link it to this repo add a ping / pong command that tests that everything is working


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Dec 11, 2025
Copilot AI and others added 2 commits December 11, 2025 00:36
Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
Co-authored-by: DonnieBLT <128622481+DonnieBLT@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ping/pong command for GitHub app setup Add GitHub App setup guide and webhook integration with ping/pong test command Dec 11, 2025
Copilot AI requested a review from DonnieBLT December 11, 2025 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants