Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions develop-docs/integrations/github.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,40 @@ title: GitHub Integration
sidebar_title: GitHub
---

## Configure ngrok

`ngrok` allows your local developer environment to be reachable by Github callbacks and webhooks and is needed for the `${url-prefix}` later on in this setup.

Follow the steps in the [ngrok documentation](/development-infrastructure/ngrok/) to get started.

## Create a GitHub App

To configure the GitHub integration you'll need to create a GitHub app and obtain credentials. Installation will fail if your GitHub App's name contains spaces.

For local development make sure to use your ngrok URL as the prefix.

<Alert level="warning">
The GitHub App name and GitHub Org Slug must not contain any spaces.
</Alert>

<CreateGitHubAppForm url="https://github.com/organizations/:org/settings/apps/new?name=:org-Sentry-Integration&public=false&members=read&emails=read&administration=read&contents=read&issues=write&pull_requests=write&repository_hooks=write&url=:url-prefix&callback_url=:url-prefix%2Fauth%2Fsso%2F&setup_url=:url-prefix%2Fextensions%2Fgithub%2Fsetup%2F&webhook_url=:url-prefix%2Fextensions%2Fgithub%2Fwebhook%2F&events[]=push&events[]=pull_request&webhook_active=true" defaultOrg="your-organization" defaultUrlPrefix="https://your-sentry-url-prefix.com" />
<CreateGitHubAppForm
url="https://github.com/organizations/:org/settings/apps/new?name=:org-Sentry-Integration&public=false&members=read&emails=read&administration=read&contents=read&issues=write&pull_requests=write&repository_hooks=write&url=:url-prefix&callback_url=:url-prefix%2Fauth%2Fsso%2F&setup_url=:url-prefix%2Fextensions%2Fgithub%2Fsetup%2F&webhook_url=:url-prefix%2Fextensions%2Fgithub%2Fwebhook%2F&events[]=push&events[]=pull_request&webhook_active=true"
defaultOrg="your-organization"
defaultUrlPrefix="https://your-sentry-url-prefix.com"
/>

Start by following GitHub's [official guide on creating a GitHub App](https://developer.github.com/apps/building-github-apps/creating-a-github-app/).

If the form above does not work for you, you need the following settings for your GitHub Application.
You'll need to come up with your own webhook secret:

| Setting | Value |
| ------------------------------- | ----------------------------------------------------------------------- |
| Homepage URL | `${url-prefix}` |
| Callback URLs | `${url-prefix}/auth/sso/` and `${url-prefix}/extensions/github/setup/` |
| Setup URL (optional) | `${url-prefix}/extensions/github/setup/` |
| Webhook URL | `${url-prefix}/extensions/github/webhook/` |
| Webhook secret | "my-super-secret-example-secret" |
| Setting | Value |
| -------------------- | ---------------------------------------------------------------------- |
| Homepage URL | `${url-prefix}` |
| Callback URLs | `${url-prefix}/auth/sso/` and `${url-prefix}/extensions/github/setup/` |
| Setup URL (optional) | `${url-prefix}/extensions/github/setup/` |
| Webhook URL | `${url-prefix}/extensions/github/webhook/` |
| Webhook secret | "my-super-secret-example-secret" |

When prompted for permissions, choose the following:

Expand All @@ -34,17 +46,20 @@ When prompted for permissions, choose the following:
| Repository / Contents | Read-only |
| Organization permissions / members (optional) | Read-only |
| Account permissions / Email addresses (optional) | Read-only |
| Repository / Checks | Read & write |
| Repository / Commit Statuses | Read & write |
| Repository / Issues | Read & write |
| Repository / Pull requests | Read & write |
| Repository / Webhooks | Read & write |

When prompted to subscribe to events, choose the following:

- Pull Request
- Push
- Pull Request
- Push

<Alert title="Trick">
Enabling optional permissions will also enable the <Link to="/self-hosted/sso/#github-auth">GitHub SSO</Link> for your instance.
Enabling optional permissions will also enable the{" "}
<Link to="/self-hosted/sso/#github-auth">GitHub SSO</Link> for your instance.
</Alert>

You'll be given various credentials, configure them in `config.yml`:
Expand All @@ -63,7 +78,8 @@ github-app.webhook-secret: "my-super-secret-example-secret"
```

<Alert title="Invalid Application Name">
If you're receiving invalid application or application not found error, it's suggested to change the `github-app.name` to the correct application slug.
If you're receiving invalid application or application not found error, it's
suggested to change the `github-app.name` to the correct application slug.
This can occur if the application includes non-alphanumeric characters.
</Alert>

Expand Down