2021-12-21 16:41:19 +00:00
Setting up GitHub
======
## GitHub App
This bridge requires a [GitHub App ](https://github.com/settings/apps/new ). You will need to create one.
2022-01-11 18:44:16 +00:00
### Webhook
The **Webhook URL** should point to the public address of your hookshot instance, at the `/` path.
You **MUST** also provide a secret, which should match the `github.webhook.secret` value in your config.
### Permissions
2021-12-21 16:41:19 +00:00
You will need to enable the following permissions:
- Repository
- Actions (`read` )
- Contents (`read` )
- Discussions (`read & write` )
- Issues (`read & write` )
2022-07-11 09:37:06 -04:00
- Metadata
2021-12-21 16:41:19 +00:00
- Projects (`read & write` )
- Pull requests (`read & write` )
- Organisation
2022-01-11 18:44:16 +00:00
- Team Discussions (`read & write` )
2021-12-21 16:41:19 +00:00
Hookshot handles the following webhook event types:
- Commit comment
- Create
- Delete
- Discussion
- Discussion comment
- Issue comment
- Issues
- Project
- Project card
- Project column
- Pull request
- Pull request review
- Pull request review comment
- Push
- Release
- Repository
- Workflow run
You can disable any of these to disable the events being handled in Hookshot.
2022-11-21 18:38:50 +01:00
Once you have set up your app, you can move onto configuring the bridge:
2021-12-21 16:41:19 +00:00
2022-01-11 18:44:16 +00:00
## Bridge Configuration
2021-12-21 16:41:19 +00:00
The GitHub service requires a few connection options.
```yaml
github:
2022-05-25 11:07:07 +01:00
enterpriseUrl: "https://your-enterprise-address.com"
2021-12-21 16:41:19 +00:00
auth:
id: 123
privateKeyFile: github-key.pem
webhook:
secret: secrettoken
oauth:
client_id: foo
client_secret: bar
2024-02-26 02:45:30 -06:00
redirect_uri: https://example.com/oauth/
2021-12-21 16:41:19 +00:00
defaultOptions:
showIssueRoomLink: false
```
2022-05-25 11:07:07 +01:00
If you are using an on-premise / enterprise edition of GitHub, you need provide the base URL in `enterpriseUrl` .
You do not need to specify the `/api/...` path in the URL.
2021-12-21 16:41:19 +00:00
In the `auth` section, you will need to supply the **App ID** given in your GitHub App page.
2022-01-11 18:44:16 +00:00
The `privateKeyFile` can be generated by clicking "Generate a private key" under the **Private keys** section on the GitHub app page.
Docker users should store this file alongside `config.yml` and provide the path `/data/github-key.pem` .
2021-12-21 16:41:19 +00:00
The `webhook` section takes a secret, which is **Webhook secret** on the GitHub App page.
The `oauth` section should include both the **Client ID** and **Client Secret** on the GitHub App page.
The `redirect_uri` value must be the **public** path to `/oauth` on the webhooks path. E.g. if your load balancer
2022-01-06 13:39:08 +00:00
points `https://example.com/hookshot` to the bridge `webhooks` listener, you should use the path `https://example.com/hookshot/oauth` .
2021-12-21 16:41:19 +00:00
This value MUST exactly match the **Callback URL** on the GitHub App page.
`defaultOptions` allows you to set some defaults for room connections. Options listed on [this page ](../usage/room_configuration/github_repo.md#configuration )
are supported.
## Next steps
If you have followed these steps correctly, GitHub should now be configured with hookshot 🥳.
2022-11-07 09:19:46 -05:00
You can now follow the guide on [authenticating with GitHub ](../usage/auth.md#github ), and then [bridging a room ](../usage/room_configuration/github_repo.md#setting-up )