Creating a GitHub app
In order to create and use GitHub webhooks, you will need a GitHub app. P4 Plan uses this app to connect to the GitHub repository with an App ID and private key.
1. In GitHub, go to Settings > Developer settings > GitHub Apps > New GitHub App.
For an organization, use the organization's settings.
2. Enter a name and a homepage URL
3. For example, your P4 Plan web client URL.
4. Under Webhook, clear Active.
5. This does not apply if you're setting up incoming webhooks. See Setting up GitHub incoming webhooks.
6. Under Repository permissions, set the following:
| Permission | Access | Used for |
|---|---|---|
| Contents | Read and write | Reading branches and commits, creating branches, commenting on linked commits |
| Pull requests | Read and write | Reading pull requests, adding a P4 Plan link to their description |
| Metadata | Read-only | Required by GitHub |
7. For incoming webhooks, subscribe to only Push and Pull request.
8. Select Only on this account and create the app.
Save the App ID as you will need this when you create the webhook.
9. Go to Credentials > Key pairs and select New key.
This downloads a .pem file, which you will use when creating the webhook.
10. Select Install App and install it on the repositories you want to use.