-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (54 loc) · 2.02 KB
/
develop-to-main-batch.yml
File metadata and controls
66 lines (54 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Develop to Main 브랜치 동기화
on:
workflow_dispatch: # 수동 실행 가능
jobs:
develop-to-main:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: 저장소 체크아웃
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: develop
- name: Git 설정
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Develop 브랜치 변경사항 확인 및 동기화
run: |
git fetch origin develop
NEW_COMMITS=$(git log --since="@{24 hours ago}" --format="%H" origin/develop)
if [ ! -z "$NEW_COMMITS" ]; then
echo "✨ develop 브랜치에 새로운 커밋이 발견되었습니다."
git checkout main
git pull origin main
git merge origin/develop --no-ff -m "🔄 develop → main 자동 동기화"
git push origin main
echo "✅ main 브랜치 동기화가 완료되었습니다."
else
echo "💡 develop 브랜치에 새로운 변경사항이 없습니다."
fi
- name: 실패 시 알림
if: failure()
# env:
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
# uses: Ilshidur/action-discord@master
# with:
# args: |
# 🚨 **브랜치 동기화 실패 알림**
#
# **저장소:** ${{ github.repository }}
# **워크플로우:** ${{ github.workflow }}
# **실행자:** ${{ github.actor }}
# **실행 시간:** ${{ github.event.schedule }}
#
# **상세 정보:**
# - 작업 URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
#
# 빠른 확인이 필요합니다! 🔍
run: |
echo "❌ 브랜치 동기화 중 오류가 발생했습니다."
exit 1