|
2 | 2 |
|
3 | 3 | This integration connects GitHub Discussions to GitBook, allowing you to automatically ingest closed discussions for AI-powered documentation improvements. |
4 | 4 |
|
5 | | -## Features |
| 5 | +## Features & setup |
6 | 6 |
|
7 | 7 | - **GitHub App Integration**: Full GitHub App with organization and repository-level permissions |
8 | 8 | - **Batch Ingestion**: Import all closed discussions on initial setup |
9 | 9 | - **Real-time Updates**: Webhook-based ingestion of newly closed discussions |
10 | 10 | - **Repository Selection**: Choose specific repositories or entire organizations |
11 | | -- **Automatic Webhook Management**: Programmatically manage webhooks for selected repositories |
12 | | - |
13 | | -## Setup |
14 | 11 |
|
15 | 12 | 1. Install the integration from GitBook |
16 | 13 | 2. Authorize with GitHub (will create a GitHub App installation) |
17 | 14 | 3. Select the organization and repositories to monitor |
18 | 15 | 4. The integration will automatically set up webhooks and ingest existing closed discussions |
19 | 16 |
|
20 | | -## How it Works |
21 | | - |
22 | | -The integration uses GitHub's GraphQL API to query discussions and REST API webhooks to receive real-time updates when discussions are closed. It converts GitHub discussions into GitBook conversation format for AI analysis. |
23 | | - |
24 | | -## Creating a GitHub App |
| 17 | +## Development - Creating a GitHub App |
25 | 18 |
|
26 | 19 | To set up this integration, you need to create a GitHub App with the following configuration: |
27 | 20 |
|
28 | 21 | ### App Settings |
29 | 22 | - **GitHub App name**: `gitbook-github-conversations` (or your preferred name) |
30 | | -- **Homepage URL**: `https://www.gitbook.com` |
31 | | -- **User authorization callback URL**: `https://api.gitbook.com/v1/integrations/github-conversations/oauth` |
32 | | -- **Setup URL**: `https://api.gitbook.com/v1/integrations/github-conversations/setup` |
33 | | -- **Webhook URL**: `https://api.gitbook.com/v1/integrations/github-conversations/webhook` |
| 23 | +- **Homepage URL**: `https://www.example.com` |
| 24 | +- **Setup URL**: `<your-integration-api-baser-url>/integrations/github-conversations/integration/setup` |
| 25 | +- **Webhook URL**: `<your-integration-api-baser-url>/integrations/github-conversations/integration/webhook` |
| 26 | +- **Webhook secret**: Set a secure secret for webhook validation |
34 | 27 |
|
35 | 28 | ### Permissions Required |
36 | 29 | - **Repository permissions**: |
37 | 30 | - **Discussions**: Read access to repository discussions |
38 | | - - **Webhooks**: Write access to create and manage webhooks |
39 | 31 | - **Metadata**: Read access to repository information |
40 | 32 |
|
41 | 33 | ### Webhook Events |
42 | 34 | Subscribe to these webhook events: |
43 | 35 | - **Discussion** events (for real-time ingestion when discussions are closed) |
44 | | -- **Installation** events (to handle app installation and removal) |
45 | 36 |
|
46 | 37 | ### After Creating the App |
47 | 38 | 1. Note down the **App ID** and generate a **Private Key** |
48 | 39 | 2. Generate a **Client Secret** |
49 | 40 | 3. Set a **Webhook Secret** for security |
50 | | -4. Configure these secrets in your GitBook integration environment variables: |
51 | | - - `GITHUB_APP_ID` |
52 | | - - `GITHUB_PRIVATE_KEY` |
53 | | - - `CLIENT_ID` |
54 | | - - `CLIENT_SECRET` |
55 | | - - `WEBHOOK_SECRET` |
| 41 | +4. Configure these environment variables baased on your GitHub App settings: |
| 42 | + |
| 43 | +```bash |
| 44 | +GITHUB_APP_ID=123456 |
| 45 | +GITHUB_APP_NAME=your-github-app-name |
| 46 | +GITHUB_WEBHOOK_SECRET=your-secure-webhook-secret |
| 47 | +GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA...\n-----END RSA PRIVATE KEY-----" |
| 48 | +GITHUB_CLIENT_ID=Iv23liXXXXXXXXXXXXXX |
| 49 | +GITHUB_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 50 | +``` |
| 51 | + |
| 52 | +Publish the app and you're ready to go. |
0 commit comments