You will need to create a GitHub app to self-host a GitHub integration.
- Follow steps 1 to 7 in GitHub's docs on creating an app.
- Add your callback URL:
- Un-toggle the expiration of user tokens, and toggle Request user authorization (OAuth) during installation.
- Set up the repository permissions. Allow Read Only access to:
- Repository Permissions:
- Pull Requests
- Organisation permissions:
- User permissions:
- Email addresses
- Click on Create GitHub app at the bottom of the page.
- Set up environment variables in
- App ID ->
- Client ID ->
- Generate a client secret ->
- Get the private key to the environment:
- Generate a private key
- Convert it into a one-liner using
-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA4+dAC4eHchsLra6dUtFbZSHpAD9iaQxXTfc+CpBTumvY7klf CE4Q6M+VQ86WLusiBPV/p20QDcQIshht69sRdBxWJyGEK6thoKHMU+MD48TdMaQj ...
-----BEGIN RSA PRIVATE KEY---\nMIIEpAIBAAKCAQEA4+dAC4eHchsLra6dUtFbZSHpAD9iaQxXTfc+CpBTumvY7klf\nCE4Q6M+VQ86WLusiBPV/p20QDcQIshht69sRdBxWJyGEK6thoKHMU+MD48TdMaQj\n...
- Add it to the environment in
backend/.env -> GITHUB_PRIVATE_KEY
Webhooks in local
We currently do not have good support for GitHub webhooks in our local environment. When deploying integrations locally, it will give you a GitHub URL. You can use this temporarily (see the next section on how to set up webhooks). However, when you restart your local environment the URL will change.
- Add the GitHub installation URL to the frontend environment variables in
To have a production GitHub app, you must create a new one and repeat all the steps. The difference is that the redirect URL will instead be your production URL, and the environment variables will be copied to your
.env.prod. When deploying to production, you can also set up webhooks.
- In your
backend/.env.prodset a random, long string to the
- Re-deploy the integrations micro-service and copy the webhook URL displayed in the console.
- Navigate to your GitHub app settings. In the General section, navigate to the Webhook section.
- Copy the following settings (replacing the URL with the generated URL and the secret with your secret):
Click on Save Changes.
Navigate to Permissions and Events on the left-side panel and scroll down to Subscribe to Events. Toggle the following:
- Issue comment
- Pull request
- Discussion comment
Done! After connecting the integration, new events will automatically be added to your crowd. dev deployment.
Updated 2 months ago