forked from elizaOS/eliza
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (68 loc) · 2.45 KB
/
sync-upstream.yaml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Sync Fork with Upstream
on:
# Runs every 5 minutes
schedule:
- cron: "*/5 * * * *"
# Allow manual trigger
workflow_dispatch:
jobs:
sync:
name: Sync with upstream
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Add upstream remote
run: |
git remote add upstream https://github.com/elizaOS/eliza.git
git remote -v
- name: Fetch upstream
run: git fetch upstream
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git config pull.rebase true
# Sync main branch
- name: Sync main branch
run: |
git checkout main
git pull origin main
git merge upstream/main
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
# Add sync develop branch
- name: Sync develop branch
run: |
git fetch origin develop
git checkout develop || git checkout -b develop
git pull origin develop
git merge upstream/develop
git push origin develop
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
# Updated to merge both main and develop into sif-dev
- name: Merge into sif-dev
run: |
git fetch origin sif-dev
git checkout sif-dev
git pull origin sif-dev
# Try to merge main into sif-dev
git merge main --strategy-option ours || {
git merge --abort
git reset --hard
git merge -X ours main
}
# Try to merge develop into sif-dev
git merge develop --strategy-option ours || {
git merge --abort
git reset --hard
git merge -X ours develop
}
git push origin sif-dev
env:
GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}