Skip to content

Notion Command Center Sync #1042

Notion Command Center Sync

Notion Command Center Sync #1042

Workflow file for this run

name: Notion Command Center Sync
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
schedule:
# Run every 6 hours
- cron: '0 */6 * * *'
jobs:
sync:
name: Sync Distributed AI Data to Notion Command Center
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history for comprehensive sync
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: |
npm ci --legacy-peer-deps
npm install @notionhq/client dotenv --legacy-peer-deps
- name: Check for Notion secrets
id: check-secrets
run: |
if [ -z "${{ secrets.NOTION_API_KEY }}" ]; then
echo "::warning::NOTION_API_KEY secret not configured. Please add it in repository settings."
echo "configured=false" >> $GITHUB_OUTPUT
else
echo "configured=true" >> $GITHUB_OUTPUT
fi
- name: Sync to Notion Command Center
if: steps.check-secrets.outputs.configured == 'true'
env:
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHITTY_REGISTRY_API_KEY: ${{ secrets.CHITTY_REGISTRY_API_KEY }}
run: |
node scripts/notion-sync.js
- name: Skip sync (secrets not configured)
if: steps.check-secrets.outputs.configured != 'true'
run: |
echo "::notice::Notion sync skipped. Configure NOTION_API_KEY and NOTION_DATABASE_ID secrets to enable sync."
echo "See .github/NOTION_SETUP.md for setup instructions."
- name: Update sync status
if: always() && steps.check-secrets.outputs.configured == 'true'
env:
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
NOTION_STATUS_PAGE_ID: ${{ secrets.NOTION_STATUS_PAGE_ID }}
run: |
node scripts/update-sync-status.js "${{ job.status }}"
- name: Send notification on failure
if: failure()
uses: actions/github-script@v9
with:
script: |
const issue = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Notion Sync Failed - Run #${context.runNumber}`,
body: `The Notion Command Center sync has failed.\n\n**Run:** #${context.runNumber}\n**Commit:** ${context.sha}\n**Triggered by:** ${context.actor}\n\n[View workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`,
labels: ['bug', 'notion-sync']
});