Skip to content

feat(contribute): Notion → docs/contribute/ 동기화 스크립트 추가 #17

feat(contribute): Notion → docs/contribute/ 동기화 스크립트 추가

feat(contribute): Notion → docs/contribute/ 동기화 스크립트 추가 #17

Workflow file for this run

name: Notion Sync

Check failure on line 1 in .github/workflows/notion-sync.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/notion-sync.yml

Invalid workflow file

(Line: 43, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.NOTION_CONTRIBUTE_DATABASE_ID != ''
on:
schedule:
- cron: '0 1 * * *' # 매일 KST 10:00 (UTC 01:00)
workflow_dispatch:
inputs:
fetch_mode:
description: 'DAILY (어제 날짜만) 또는 ALL (전체)'
required: false
default: 'DAILY'
type: choice
options:
- DAILY
- ALL
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: pip install requests
- name: Sync blog
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
FETCH_MODE: ${{ github.event.inputs.fetch_mode || 'DAILY' }}
run: python scripts/notion_to_blog.py
- name: Sync contribute (NOTION_CONTRIBUTE_DATABASE_ID 설정 시)
if: ${{ secrets.NOTION_CONTRIBUTE_DATABASE_ID != '' }}
env:
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
NOTION_CONTRIBUTE_DATABASE_ID: ${{ secrets.NOTION_CONTRIBUTE_DATABASE_ID }}
FETCH_MODE: ${{ github.event.inputs.fetch_mode || 'ALL' }}
run: python scripts/notion_to_contribute.py
- name: Commit and push if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add blog/ static/img/blog/ docs/contribute/ static/img/contribute/ 2>/dev/null || git add blog/
git diff --staged --quiet || git commit -m "chore: Notion 자동 동기화 $(date +'%Y-%m-%d')"
git push