Skip to content

Commit 66f7dbb

Browse files
committed
added support for syncing issues
1 parent a0de6b6 commit 66f7dbb

File tree

6 files changed

+11605
-1358
lines changed

6 files changed

+11605
-1358
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,5 @@ dist
169169
# wrangler project
170170

171171
.dev.vars
172+
173+
src/types.ts

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
11
# notion-github-sync
22

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.
3+
This bot syncs public Notion pages as GitHub Discussions/Issues. It's done periodically, based on the pages shared with the Notion Integration, and based on metadata specific on your Notion page.
44

5-
## Usage
5+
## Usage
66

77
To use this tool, please make sure to have the following:
88

99
1. Deploy this tool or run it locally with the relevant env vars.
1010
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:
11+
3. To make a Notion page public and syncable, first make sure to share this page with the Notion Integration you created:
1212

1313
![image](https://user-images.githubusercontent.com/3680083/177030441-7110357f-5f48-400e-b043-ed77fda794f1.png)
1414

15-
4. If you wish to make the Notion page public (with the Notion url), also tick `Share to web`:
15+
4. If you wish to make the Notion page public (with the Notion url), also tick `Share to web`:
1616

1717
![image](https://user-images.githubusercontent.com/3680083/177030470-bd8bafc5-a0ee-4c2e-920b-a7b3d2000483.png)
1818

1919
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):
2020

2121
```
22-
/github-public dotansimha/test-notion-sync
22+
/github-public dotansimha/test-notion-sync discussion
2323
```
2424

25-
You can also specify a custom GitHub Discussion category (the default is General):
25+
You can also specify a custom GitHub Discussion category (the default is General):
2626

2727
```
28-
/github-public dotansimha/test-notion-sync General
28+
/github-public dotansimha/test-notion-sync discussion General
2929
```
3030

31-
You can find an synced example page here: https://github.com/dotansimha/test-notion-sync/discussions/12
31+
Or, as an issue:
3232

33+
You can also specify a custom GitHub Discussion category (the default is General):
34+
35+
```
36+
/github-public dotansimha/test-notion-sync issue
37+
```
38+
39+
You can find a synced example page here: https://github.com/dotansimha/test-notion-sync/discussions/12
3340

3441
To remove a public discussion:
3542

@@ -39,19 +46,19 @@ To remove a public discussion:
3946

4047
## Getting started (development)
4148

42-
1. Clone this repo
49+
1. Clone this repo
4350
2. Make sure to install Wrangler CLI: https://developers.cloudflare.com/workers/wrangler/get-started/
4451
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.
4552
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.
4653
5. Run `npm install`
47-
6. Run `npm start` for development.
54+
6. Run `npm start` for development.
4855

4956
> We use Wrangler for the Worker development.
5057
5158
## Deployment (as CloudFlare Worker)
5259

53-
- Every change to `main` branch will run CI and deploy to prod.
54-
- Make sure to configure your `NOTION_TOKEN` and `GH_BOT_TOKEN` (PAT) as part of the env vars.
60+
- Every change to `main` branch will run CI and deploy to prod.
61+
- Make sure to configure your `NOTION_TOKEN` and `GH_BOT_TOKEN` (PAT) as part of the env vars.
5562
- You can also deploy from local env by running: `npm run deploy`
5663

5764
> If you wish to have a clone of your own, make sure to rename worker name in the `wrangler.toml` file

codegen.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
schema:
2+
- https://api.github.com/graphql:
3+
headers:
4+
Authorization: Bearer ${GH_BOT_TOKEN}
5+
documents: "src/**/*.ts"
6+
generates:
7+
src/types.ts:
8+
config:
9+
scalars:
10+
URI: string
11+
plugins:
12+
- "typescript"
13+
- "typescript-operations"

0 commit comments

Comments
 (0)