Self-hosted GitHub integration
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 base64 encoded one-liner using https://www.base64encode.org/ or with a
cat key.pem | base64 -w 0:
-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEA4+dAC4eHchsLra6dUtFbZSHpAD9iaQxXTfc+CpBTumvY7klf CE4Q6M+VQ86WLusiBPV/p20QDcQIshht69sRdBxWJyGEK6thoKHMU+MD48TdMaQj ...
- Add it to the environment in
backend/.env.override.local -> CROWD_GITHUB_PRIVATE_KEY
Your app is not set up! Now you can set up your GitHub integration through your deployment of crowd.dev! For more information on how to set up the integration, see GitHub integration.
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.
Setting up webhooks
- Set a random, long string to the
- Re-deploy the
- Navigate to your GitHub app settings. In the General section, navigate to the Webhook section.
- Copy the following settings (replacing the URL with the URL of you
apiservice instance webhook URL for example
https://app.test.com/api/webhhoks/githuband 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 4 months ago