You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minimal example of a GitHub App using [octokit.js](https://github.com/octokit/octokit.js).
4
+
5
+
## Requirements
6
+
7
+
- Node.js 12 or higher
8
+
- A GitHub App subscribed to **Pull Request** events and with the following permissions:
9
+
- Pull requests: Read & write
10
+
- Metadata: Read-only
11
+
- (For local development) A tunnel to expose your local server to the internet (e.g. [smee](https://smee.io/), [ngrok](https://ngrok.com/) or [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/local/))
12
+
13
+
## Setup
14
+
15
+
1. Clone this repository.
16
+
2. Create a `.env` file similar to `.env.example` and set actual values.
17
+
3. Install dependencies with `npm install`.
18
+
4. Start the server with `npm run server`.
19
+
5. Ensure your server is reachable from the internet.
20
+
- If you're using `smee`, run `smee -u <smee_url> -t http://patman.localhost:3000/api/hook`.
21
+
6. Ensure your GitHub App includes at least one repository on its installations.
22
+
23
+
## Usage
24
+
25
+
With your server running, you can now create a pull request on any repository that
26
+
your app can access. GitHub will emit a `pull_request.opened` and will deliver
27
+
the corresponding Webhook [payload](https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request) to your server.
28
+
29
+
The server in this example listens for `pull_request.opened` events and acts on
30
+
them by creating a comment on the pull request, with the message in `message.md`,
31
+
using the [octokit.js rest methods](https://github.com/octokit/octokit.js#octokitrest-endpoint-methods).
0 commit comments