File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : automatic sync main branch from llvm-project to llvm
2+
3+ on :
4+ schedule :
5+ - cron : ' /10 * * * *'
6+ jobs :
7+ sync :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : actions/checkout@v2
11+ with :
12+ # persist-credentials: false allows us to use our own credentials for
13+ # pushing to the repository. Otherwise, the default github actions token
14+ # is used.
15+ persist-credentials : false
16+ fetch-depth : 0
17+ path : src
18+ - name : Sync
19+ env :
20+ BRANCH : main
21+ SYNC_REPO : https://github.com/llvm/llvm-project
22+ LLVMBOT_TOKEN : ${{ secrets.LLVM_MAIN_SYNC_BBSYCL_TOKEN }}
23+ run : |
24+ cd $GITHUB_WORKSPACE/src
25+ branch_exist=`git ls-remote --heads origin $BRANCH | wc -l`
26+ if [ $branch_exist -ne 0 ]; then
27+ git checkout $BRANCH
28+ git pull --ff --ff-only $SYNC_REPO $BRANCH
29+ if [ $? -ne 0 ]; then
30+ echo "failed to pull from $SYNC_REPO $BRANCH, abort"
31+ exit 1
32+ fi
33+ git_status=`git rev-list --count --left-right origin/$BRANCH...$BRANCH`
34+ if [ "0 0" == "$git_status" ] ; then
35+ echo "no change, skip"
36+ elif [[ "$git_status" = 0* ]] ; then
37+ git push https://[email protected] /${{ github.repository }} ${BRANCH} 38+ else
39+ echo "$BRANCH branch invalid state"
40+ exit 1
41+ fi
42+ else
43+ git remote add upstream $SYNC_REPO
44+ git fetch upstream
45+ git checkout -B $BRANCH upstream/$BRANCH
46+ git push https://[email protected] /${{ github.repository }} ${BRANCH} 47+ fi
48+ echo "sync finished"
You can’t perform that action at this time.
0 commit comments