-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (43 loc) · 1.33 KB
/
sync.yml
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
name: Sync to Second repo
on:
push:
branches:
- main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Git
run: |
git config --global user.name 'googoo9918'
git config --global user.email '[email protected]'
git remote add second https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OneDay-OneAlgorithm/JungDongGyu.git
- name: Fetch from second
run: git fetch second
- name: Create worktree
run: git worktree add ../worktree HEAD
- name: Remove .github directory in worktree
run: |
cd ../worktree
rm -rf .github
git add .
git commit --amend --no-edit
- name: Rebase onto second/main from worktree
run: |
cd ../worktree
git rebase second/main || git rebase --abort
- name: Merge second/main from worktree
if: failure()
run: |
cd ../worktree
git merge -X ours second/main
- name: Push to second from worktree
run: |
cd ../worktree
git push second HEAD:main --force-with-lease
- name: Clean up worktree
run: git worktree remove ../worktree