forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 1.43 KB
/
sync_upstream.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
name: 'Sync With Upstream'
on:
schedule:
- cron: '30 0 * * *'
tags-ignore:
- '**'
workflow_dispatch:
env:
upstream_branch: "master"
branchname: "bradh352/master"
projects: "sonic-swss sonic-sairedis sonic-platform-daemons"
jobs:
sync_latest_from_upstream:
runs-on: ubuntu-latest
name: Sync latest commits from upstream repo
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout sonic-build
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update
run: |
git config --global user.name '[github actions]'
git config --global user.email '[email protected]'
git pull
git remote add upstream https://github.com/sonic-net/sonic-buildimage.git
git fetch upstream
if ! git rebase upstream/${upstream_branch} ; then
while ! git rebase --skip ; do
echo "Skipped Commit"
done
fi
git submodule update --init --recursive
for project in ${projects} ; do
cd src/${project}
git checkout ${branchname}
git pull
cd ../..
done
git add .
if git status | grep "nothing to commit" > /dev/null ; then
echo "nothing to commit"
else
git commit -am "update ${projects} branches"
fi
git push --force