Skip to content

Tool for syncing markdown files and wikis from a Github repository into Notion.

Notifications You must be signed in to change notification settings

jberglinds/github-notion-sync

Repository files navigation

Github Notion Sync

What?

Tool for syncing markdown files and wikis from a Github repository into Notion.

Why?

Because we like our documentation to live with the resources it documents, yet still be searchable from one place.

Let's go!™️

Requirements:

  • The ID of the page in Notion where you want your documentation to end up.
  • An access key for an integration with permissions to edit the above page.
    • An integration can be created here.
    • Use the "Share" button on a Notion page to give the integration permissions.

CLI

# Getting it
git clone [email protected]:jberglinds/github-notion-sync.git
cd github-notion-sync

# Syncing example, will use the current working directory as content root
npx ts-node src/cli.ts \
  --notionAccessToken <token>
  --notionPageId <page id> \
  # Optional, set if syncing wiki:
  --wikiCheckoutPath wiki/ \
  # Optional arguments for backlinking to github from Notion:
  --repository webbhalsa/dave \
  --branch release
 
# See all options
npx ts-node src/cli.ts --help

Github Workflow

The secrets.NOTION_ACCESS_TOKEN should be set up in Repository Settings -> Secrets -> Actions.

Example workflow:

# ./github/workflows/notion-sync.yml
name: Notion Sync

on:
  workflow_dispatch:
  gollum:

jobs:
  sync:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Checkout wiki
        uses: actions/checkout@v3
        with:
          repository: ${{ github.repository }}.wiki
          path: wiki

      - uses: jberglinds/github-notion-sync@main
        with:
          NOTION_ACCESS_TOKEN: ${{ secrets.NOTION_ACCESS_TOKEN }}
          NOTION_PAGE_ID: <your notion page id that will become the root of documentation>
          WIKI_CHECKOUT_PATH: wiki # optional

The gollum event triggers the workflow every time a wiki page is changed.

Development

npm install

Publishing

# Build typescript src/ into dist/
npm run package

# Commit/push

About

Tool for syncing markdown files and wikis from a Github repository into Notion.

Resources

Stars

Watchers

Forks