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