How github/github-app-js-sample works
Project type and purpose
• This is a Node.js GitHub App that listens for Pull Request webhook events and reacts by posting a comment.
• It uses octokit.js for API calls and can run locally behind a tunnel (smee, ngrok, cloudflared) or in a deployed environment.
File structure
• Top-level files:
• app.js – entry point, defines Express server and webhook endpoint (/api/webhook)
• message.md – the template used for comments
• .env.sample – environment variable definitions (APP ID, PRIVATE KEY, WEBHOOK SECRET, etc.)
• package.json / package-lock.json – Node dependencies, including @octokit/rest and @octokit/auth-app
• .github/workflows/linting.yml – CI workflow for linting
• No separate “frontend” or “backend” directories: it’s a single-purpose webhook service.
README for additional insights
• Describes required GitHub App permissions (pull_requests read/write, metadata read)
• Emphasizes use of a tunnel to expose localhost for webhook delivery
• Workflow: receive pull_request.opened → create JWT → get installation token → post comment via octokit.rest