Notion Sync #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Notion Blog Sync | |
| 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 Notion to 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: 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/ 2>/dev/null || git add blog/ | |
| git diff --staged --quiet || git commit -m "chore(blog): Notion 자동 동기화 $(date +'%Y-%m-%d') [skip ci]" | |
| git push |