Skip to content

feat(sync): docs/*.md → Notion 역방향 동기화 구현 - #13

Merged
sungbin1015 merged 10 commits into
developfrom
feat/md-to-notion-clean
May 27, 2026
Merged

sungbin1015 merged 10 commits into
developfrom
feat/md-to-notion-clean

Conversation

@sungbin1015

@sungbin1015 sungbin1015 commented May 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

로컬에서 docs/*.md 작성 후 git push 만 하면 Notion DB에 자동 반영됩니다.

신규 파일

파일 설명
scripts/md_to_notion.py last_edited 비교로 변경 감지 → Notion API(수정/신규/삭제). .env 자동 로드
.github/workflows/md-to-notion.yml docs/**/*.md 변경 포함 push 시 자동 트리거 → md_to_notion.py 실행

배경

로컬에서 마크다운으로 문서를 작성·편집한 뒤 git push 만으로
Notion 반영되는 워크플로우가 필요했습니다.

동작 흐름

로컬에서 docs/*.md 작성
  → git commit + push (main 또는 develop)
  → GitHub Actions 트리거 (md-to-notion.yml)
  → md_to_notion.py 실행
    → git diff HEAD~1 HEAD 로 변경 파일 감지
    → Notion API 호출 (수정 / 신규 / 삭제)

Test plan

  • 변경 없을 때 스킵 확인
  • 파일 수정 후 Notion 블록 교체 확인
  • 신규 파일 추가 후 Notion 페이지 생성 확인
  • docs/**/*.md 변경 push 시 Actions 자동 트리거 확인
  • 파일 삭제 후 Notion 페이지 아카이브 확인

🤖 Generated with Claude Code

@sungbin1015
sungbin1015 force-pushed the feat/md-to-notion-clean branch 2 times, most recently from 0c190d1 to 741a5af Compare May 27, 2026 04:27
@sungbin1015

sungbin1015 commented May 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

.notion-sync.json 역할

각 docs/{섹션}/ 디렉토리에 생성되는 상태 파일로, 아래 정보를 저장합니다.

{
  "page_id": {
    "file": "docs/about/소개.md",
    "last_edited": "2026-05-27T02:30:00.000Z",
    "order": 1,
    "parent_id": null
  }
}

last_edited 기재로 인하여, 커밋할지말지를 판단시킵니다

- scripts/md_to_notion.py: git diff 기반 변경 감지 → Notion 업로드
  (신규/수정/삭제 처리, MD→Notion blocks 변환, rate limit 대응)
- .github/workflows/md-to-notion.yml: docs/**/*.md push 시 자동 실행
  업로드 후 .notion-sync.json을 커밋·푸시해 server-sync 충돌 방지

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sungbin1015
sungbin1015 force-pushed the feat/md-to-notion-clean branch from 741a5af to 6c4bc98 Compare May 27, 2026 04:38
@sungbin1015
sungbin1015 merged commit 9ca0233 into develop May 27, 2026
1 check failed
@sungbin1015
sungbin1015 deleted the feat/md-to-notion-clean branch May 28, 2026 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant