一个CloudFlare Worker / script / bot,用于将Concept页面公开同步为GitHub讨论。

#Notion 一个CloudFlare Worker / script / bot,用于将Concept页面公开同步为GitHub讨论。

Aug 17, 2022 03:49 PM
notion image


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.


To use this tool, please make sure to have the following:
  1. Deploy this tool or run it locally with the relevant env vars.
  1. Make sure to add the user your wish to use as collaborator in your repos (this is needed only in order to delete Discussions)
  1. To make a Notion page public and syncable, first make sure to share this page with the Notion Integration you created:
notion image
  1. If you wish to make the Notion page public (with the Notion url), also tick Share to web:
notion image
  1. 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):
/github-public dotansimha/test-notion-sync discussion
You can also specify a custom GitHub Discussion category (the default is General):
/github-public dotansimha/test-notion-sync discussion General
Or, as an issue:
You can also specify a custom GitHub Discussion category (the default is General):
/github-public dotansimha/test-notion-sync issue
You can find a synced example page here: dotansimha/test-notion-sync#12
To remove a public discussion:
  1. Make sure to delete the annotation from your page.
  1. Wait for the next sync (or, manually run it)
  1. You can also remove now the integration access from the page.

Getting started (development)

  1. Clone this repo
  1. Make sure to install Wrangler CLI: https://developers.cloudflare.com/workers/wrangler/get-started/
  1. Create a Notion integration and get your Notion token (see https://www.notion.so/my-integrations). Use the token as NOTION_TOKEN env var.
  1. 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.
  1. Run npm install
  1. Run npm start for development.

Deployment (as CloudFlare Worker)

  • Every change to main branch will run CI and deploy to prod.
  • Make sure to configure your NOTION_TOKEN and GH_BOT_TOKEN (PAT) as part of the env vars.
  • You can also deploy from local env by running: npm run deploy