Skip to content

Sync Notion to Jekyll #76

Sync Notion to Jekyll

Sync Notion to Jekyll #76

Workflow file for this run

name: "Sync Notion to Jekyll"
on:
schedule:
- cron: "0 * * * *" # every hour
workflow_dispatch: # manual trigger from Actions tab
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: |
cd tools
npm install @notionhq/client notion-to-md
- name: Run Notion sync
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
run: node tools/notion-sync.mjs
- name: Commit and push new posts
run: |
git config user.name "notion-sync[bot]"
git config user.email "notion-sync@users.noreply.github.com"
git add _posts/
git diff --cached --quiet || git commit -m "sync: notion posts $(date -u +%Y-%m-%dT%H:%M:%SZ)"
git push