File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010
1111permissions :
1212 contents : write
13+ actions : write # deploy.yml 수동 트리거용
1314
1415jobs :
1516 merge :
6162 run : npm run build
6263
6364 - name : develop → main 머지
65+ id : merge
6466 if : steps.diff.outputs.has_changes == 'true'
6567 run : |
6668 git stash
8991 git add -A
9092 git commit -m "chore: develop → main 머지 (sync-json 충돌 자동 해소) [skip-notion]"
9193 git push origin main
94+
95+ # GITHUB_TOKEN push 는 deploy.yml(on: push)을 트리거하지 못한다 (워크플로 재귀 방지).
96+ # workflow_dispatch 는 예외라 명시 호출로 배포를 잇는다.
97+ - name : Trigger deploy
98+ if : steps.merge.outcome == 'success' && steps.diff.outputs.has_changes == 'true'
99+ env :
100+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
101+ run : gh workflow run deploy.yml --ref main
Original file line number Diff line number Diff line change 1010 runs-on : ubuntu-latest
1111 permissions :
1212 contents : write
13+ actions : write # deploy.yml 수동 트리거용
1314
1415 steps :
1516 - uses : actions/checkout@v4
@@ -30,11 +31,25 @@ jobs:
3031 run : python3 scripts/translate_to_en.py
3132
3233 - name : Commit translated files
34+ id : commit
3335 run : |
3436 git config user.name "github-actions[bot]"
3537 git config user.email "github-actions[bot]@users.noreply.github.com"
3638 git add i18n/en/ .notion-translate-hashes.json
37- git diff --cached --quiet && echo "번역 변경 없음" && exit 0
39+ if git diff --cached --quiet; then
40+ echo "번역 변경 없음"
41+ echo "pushed=false" >> $GITHUB_OUTPUT
42+ exit 0
43+ fi
3844 git commit -m "chore: EN 번역 자동 업데이트 [skip-notion]"
3945 git pull --rebase origin main
4046 git push origin main
47+ echo "pushed=true" >> $GITHUB_OUTPUT
48+
49+ # GITHUB_TOKEN 으로 push 한 커밋은 deploy.yml(on: push)을 트리거하지 못한다
50+ # (GitHub의 워크플로 재귀 방지). workflow_dispatch 는 예외라 명시 호출로 배포를 잇는다.
51+ - name : Trigger deploy
52+ if : steps.commit.outputs.pushed == 'true'
53+ env :
54+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55+ run : gh workflow run deploy.yml --ref main
Original file line number Diff line number Diff line change 11#! /bin/bash
22# Notion → docs/ 동기화 → git push
3- # 서버 crontab에서 3시간마다 실행 (0 */3 * * *)
3+ # 서버 crontab에서 6시간마다 실행 (0 */6 * * *)
44
55set -e
66
@@ -23,6 +23,19 @@ trap 'if [ -n "$ORIG_BRANCH" ] && [ "$ORIG_BRANCH" != "main" ]; then git checkou
2323# 진행 중인 rebase 중단 (이전 실행 충돌로 잠긴 경우 해제)
2424git rebase --abort 2> /dev/null || true
2525
26+ # 커밋 안 한 로컬 변경을 stash로 치운다 — checkout·pull 보다 먼저.
27+ # 이게 없으면 파일 하나가 pull --rebase 를 영구히 막아 동기화가 통째로 멈춘다
28+ # (2026-07-21 ~ 08-11, 42회 연속 실패한 실제 사례).
29+ # 추적 파일만 대상이며 stash에 보존되므로 작업은 유실되지 않는다: git stash list / git stash pop
30+ if ! git diff --quiet HEAD; then
31+ echo " [$( date) ] WARN: 커밋되지 않은 로컬 변경 감지 — stash 처리 (git stash list 로 복구 가능)"
32+ git diff --name-only HEAD
33+ if ! git stash push -m " server-sync auto-stash $( date +' %Y-%m-%d %H:%M' ) " --quiet; then
34+ echo " [$( date) ] ERROR: stash 실패, 스킵"
35+ exit 1
36+ fi
37+ fi
38+
2639# 항상 main에서 실행 보장 (실패 시 즉시 종료)
2740if ! git checkout main --quiet 2> /dev/null; then
2841 echo " [$( date) ] ERROR: main 브랜치 checkout 실패, 스킵"
You can’t perform that action at this time.
0 commit comments