Skip to content

Sync Notion Docs

Sync Notion Docs #83

Workflow file for this run

name: Sync Notion Docs
on:
workflow_dispatch:
repository_dispatch:
types:
- sync-docs
# Prevent concurrent content updates to avoid conflicts
concurrency:
group: "content-branch-updates"
cancel-in-progress: false
jobs:
pull-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout content branch
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: content
- name: Setup Bun
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
- name: Install dependencies
run: bun i
- name: Notion To Markdown
run: bun notion:fetch
env:
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
DATA_SOURCE_ID: ${{ secrets.DATA_SOURCE_ID }}
DATABASE_ID: ${{ secrets.DATABASE_ID }}
BASE_URL: /comapeo-docs/
- name: Commit generated docs
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Stage specific paths (adjust to your generated files)
git add docs
if [ -d i18n ]; then
git add i18n
fi
# Also stage generated images
if [ -d static/images ]; then
git add static/images
fi
# Force-add emoji files (they're gitignored for dev but needed for deployment)
if [ -d static/images/emojis ]; then
git add --force static/images/emojis/*
fi
# Commit if there are changes
git diff --cached --quiet || git commit -m "(content-update): update docs from Notion"
# Push to content branch
git push origin content
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Slack
if: always()
uses: slackapi/[email protected]
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
text: "*Notion sync*: ${{ job.status }} (content branch)"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Notion sync*: ${{ job.status }}\nContent branch: `content`"
- type: "section"
text:
type: "mrkdwn"
text: "Trigger: <https://github.com/${{ github.triggering_actor }}|${{ github.triggering_actor }}>\nRun: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View logs>"