Skip to content

Commit a3e2c9f

Browse files
committed
chore: trigger-fork-sync.yml 파일 추가
1 parent 0ada0ba commit a3e2c9f

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ on:
55
branches:
66
- develop
77
- main
8+
repository_dispatch: # 원본 레포에서 이벤트 발생 시 실행되도록 설정
9+
types: [sync-fork]
810

911
jobs:
1012
sync:
1113
name: Sync to Forked Repo
1214
runs-on: ubuntu-latest
1315

1416
steps:
15-
- name: Checkout branch
17+
- name: Checkout forked repo
1618
uses: actions/checkout@v4
1719
with:
1820
token: ${{ secrets.AUTO_ACTIONS }}
@@ -27,16 +29,18 @@ jobs:
2729
echo "TARGET_BRANCH=main" >> $GITHUB_ENV
2830
fi
2931
30-
- name: Add remote repository
32+
- name: Configure Git
3133
run: |
32-
git remote add forked-repo https://dewbeeny:${{ secrets.AUTO_ACTIONS }}@github.com/dewbeeny/HomePage-FE
33-
git config user.name dewbeeny
34-
git config user.email ${{ secrets.EMAIL }}
34+
git config --global user.name "GitHub Actions"
35+
git config --global user.email "[email protected]"
3536
36-
- name: Push changes to forked repo
37+
- name: Add upstream repository (original repo)
3738
run: |
38-
git push -f https://$GITHUB_ACTOR:${{ secrets.AUTO_ACTIONS }}@github.com/DguFarmSystem/HomePage-FE.git ${{ env.TARGET_BRANCH }}
39+
git remote add upstream https://github.com/DguFarmSystem/HomePage-FE.git
40+
git fetch upstream
3941
40-
- name: Clean up
42+
- name: Merge upstream changes into forked repo
4143
run: |
42-
git remote remove forked-repo
44+
git checkout ${{ env.TARGET_BRANCH }}
45+
git merge --no-edit upstream/${{ env.TARGET_BRANCH }}
46+
git push origin ${{ env.TARGET_BRANCH }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Trigger Fork Sync
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- main
8+
9+
jobs:
10+
trigger:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Send repository_dispatch event to forked repo
14+
run: |
15+
curl -X POST -H "Accept: application/vnd.github.v3+json" \
16+
-H "Authorization: token ${{ secrets.AUTO_ACTIONS }}" \
17+
https://api.github.com/repos/dewbeeny/HomePage-FE/dispatches \
18+
-d '{"event_type": "sync-fork"}'

0 commit comments

Comments
 (0)