forked from theos/theos
-
Notifications
You must be signed in to change notification settings - Fork 7
45 lines (33 loc) · 1.27 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
name: Fork Sync
on:
schedule:
- cron: '0 */3 * * *' # every 3 hours
workflow_dispatch: # on button click
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Merge upstream changes
run: |
set -e
set -x
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "[email protected]"
git remote add upstream https://github.com/theos/theos.git
git checkout master && git fetch upstream && git merge upstream/master
cd vendor/lib
git remote add upstream https://github.com/theos/lib.git
git checkout master && git fetch upstream && git merge upstream/master && git push
cd -
cd vendor/include
git remote add upstream https://github.com/theos/headers.git
git checkout master && git fetch upstream && git merge upstream/master && git push
cd -
# revert submodules to upstream commits
git submodule update --recursive
git commit --all -m "Sync Repo" && git push || echo "No changes"