|
1 | 1 | # notion-github-sync
|
2 | 2 |
|
3 |
| -For more information about this bot and it's usage: |
| 3 | +This bot syncs public Notion pages as GitHub Discussions. It's done periodically, based on the pages shared with the Notion Integration, and based on metadata specific on your Notion page. |
4 | 4 |
|
5 |
| -https://www.notion.so/theguildoss/Build-in-public-fc7180f938454b818b4ef262610a78af |
| 5 | +## Usage |
6 | 6 |
|
| 7 | +To use this tool, please make sure to have the following: |
7 | 8 |
|
8 |
| -## Getting started |
| 9 | +1. Deploy this tool or run it locally with the relevant env vars. |
| 10 | +2. Make sure to add the user your wish to use as collaborator in your repos (this is needed only in order to delete Discussions) |
| 11 | +3. To make a Notion page public and syncable, first make sure to share this page with the Notion Integration you created: |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +4. If you wish to make the Notion page public (with the Notion url), also tick `Share to web`: |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +5. Annotate the top of your Notion page with the repo you wish to sync the page with the following text (NOT as code block, just as text - this should be the first block of your Notion page): |
| 20 | + |
| 21 | +``` |
| 22 | +/github-public dotansimha/test-notion-sync |
| 23 | +``` |
| 24 | + |
| 25 | +You can also specify a custom GitHub Discussion category (the default is General): |
| 26 | + |
| 27 | +``` |
| 28 | +/github-public dotansimha/test-notion-sync General |
| 29 | +``` |
| 30 | + |
| 31 | +You can find an synced example page here: https://github.com/dotansimha/test-notion-sync/discussions/12 |
| 32 | + |
| 33 | + |
| 34 | +To remove a public discussion: |
| 35 | + |
| 36 | +1. Make sure to delete the annotation from your page. |
| 37 | +2. Wait for the next sync (or, manually run it) |
| 38 | +3. You can also remove now the integration access from the page. |
| 39 | + |
| 40 | +## Getting started (development) |
9 | 41 |
|
10 | 42 | 1. Clone this repo
|
11 | 43 | 2. Make sure to install Wrangler CLI: https://developers.cloudflare.com/workers/wrangler/get-started/
|
12 |
| -3. Run `npm install` |
13 |
| -4. Run `npm start` for development. |
| 44 | +3. Create a Notion integration and get your Notion token (see https://www.notion.so/my-integrations). Use the token as `NOTION_TOKEN` env var. |
| 45 | +4. Create a GitHub Personal Access token for the relevant user (to create/update/delete the GH Discussions). Use the token as `GH_BOT_TOKEN` env var. |
| 46 | +5. Run `npm install` |
| 47 | +6. Run `npm start` for development. |
| 48 | + |
| 49 | +> We use Wrangler for the Worker development. |
14 | 50 |
|
15 |
| -## Deployment |
| 51 | +## Deployment (as CloudFlare Worker) |
16 | 52 |
|
17 | 53 | - Every change to `main` branch will run CI and deploy to prod.
|
18 |
| -- You can also deploy from local env by running: `npm run deploy` |
| 54 | +- Make sure to configure your `NOTION_TOKEN` and `GH_BOT_TOKEN` (PAT) as part of the env vars. |
| 55 | +- You can also deploy from local env by running: `npm run deploy` |
0 commit comments