From 61c17c19c45f366eabc8b073b1e70c7832bf3df1 Mon Sep 17 00:00:00 2001 From: Han Date: Fri, 18 Dec 2020 11:06:35 +0800 Subject: [PATCH 1/5] Create sync-main.yml Create sync-main.yml to automatic sync for main branch from llvm-project to llvm --- .github/workflows/sync-main.yml | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/sync-main.yml diff --git a/.github/workflows/sync-main.yml b/.github/workflows/sync-main.yml new file mode 100644 index 0000000000000..3235a0d3155de --- /dev/null +++ b/.github/workflows/sync-main.yml @@ -0,0 +1,50 @@ +name: automatic sync main branch from llvm-project to llvm test on sycl + +on: + workflow_dispatch: + schedule: + - cron: '*/10 * * * *' +jobs: + check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + # persist-credentials: false allows us to use our own credentials for + # pushing to the repository. Otherwise, the default github actions token + # is used. + persist-credentials: false + fetch-depth: 0 + path: src + - name: Sync + env: + BRANCH: main + SYNC_REPO: https://github.com/llvm/llvm-project + LLVMBOT_TOKEN: ${{ secrets.LLVM_MAIN_SYNC_BBSYCL_TOKEN }} + run: | + cd $GITHUB_WORKSPACE/src + branch_exist=`git ls-remote --heads origin $BRANCH | wc -l` + if [ $branch_exist -ne 0 ]; then + git checkout $BRANCH + git pull --ff --ff-only $SYNC_REPO $BRANCH + if [ $? -ne 0 ]; then + echo "failed to pull from $SYNC_REPO $BRANCH, abort" + exit 1 + fi + git_status=`git rev-list --count --left-right origin/$BRANCH...$BRANCH` + if [ "0 0" == "$git_status" ] ; then + echo "no change, skip" + elif [[ "$git_status" = 0* ]] ; then + git push https://$LLVMBOT_TOKEN@github.com/${{ github.repository }} ${BRANCH} + else + echo "$BRANCH branch invalid state" + exit 1 + fi + else + git remote add upstream $SYNC_REPO + git fetch upstream + git checkout -B $BRANCH upstream/$BRANCH + git push https://$LLVMBOT_TOKEN@github.com/${{ github.repository }} ${BRANCH} + fi + echo "sync finished" From 951d923a44eb811245586ce5ea4453d998145d1e Mon Sep 17 00:00:00 2001 From: Han Date: Fri, 18 Dec 2020 12:29:00 +0800 Subject: [PATCH 2/5] Update sync-main.yml --- .github/workflows/sync-main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/sync-main.yml b/.github/workflows/sync-main.yml index 3235a0d3155de..35234b0f1236b 100644 --- a/.github/workflows/sync-main.yml +++ b/.github/workflows/sync-main.yml @@ -1,13 +1,11 @@ -name: automatic sync main branch from llvm-project to llvm test on sycl +name: automatic sync main branch from llvm-project to llvm on: - workflow_dispatch: schedule: - cron: '*/10 * * * *' jobs: check: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 with: From 0d2ba663f5ba39f76a571fb27fda3f0a8c6512de Mon Sep 17 00:00:00 2001 From: Han Date: Fri, 18 Dec 2020 13:28:20 +0800 Subject: [PATCH 3/5] Update the sync frequency to hourly --- .github/workflows/sync-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-main.yml b/.github/workflows/sync-main.yml index 35234b0f1236b..819529db6d50f 100644 --- a/.github/workflows/sync-main.yml +++ b/.github/workflows/sync-main.yml @@ -2,7 +2,7 @@ name: automatic sync main branch from llvm-project to llvm on: schedule: - - cron: '*/10 * * * *' + - cron: '0 * * * *' jobs: check: runs-on: ubuntu-latest From 4dd0189db53df74a7a327c995103461cba1fbc28 Mon Sep 17 00:00:00 2001 From: Han Date: Mon, 21 Dec 2020 09:14:11 +0800 Subject: [PATCH 4/5] Update .github/workflows/sync-main.yml to sync every 10 min Co-authored-by: Alexey Bader --- .github/workflows/sync-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-main.yml b/.github/workflows/sync-main.yml index 819529db6d50f..c2c525a7ddba2 100644 --- a/.github/workflows/sync-main.yml +++ b/.github/workflows/sync-main.yml @@ -2,7 +2,7 @@ name: automatic sync main branch from llvm-project to llvm on: schedule: - - cron: '0 * * * *' + - cron: '/10 * * * *' jobs: check: runs-on: ubuntu-latest From b04201a57b8f4f3179be614cc1c68ffb0a5fdbd7 Mon Sep 17 00:00:00 2001 From: Han Date: Mon, 21 Dec 2020 09:14:27 +0800 Subject: [PATCH 5/5] Update .github/workflows/sync-main.yml job name to sync Co-authored-by: Alexey Bader --- .github/workflows/sync-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-main.yml b/.github/workflows/sync-main.yml index c2c525a7ddba2..1c47db0acf5c9 100644 --- a/.github/workflows/sync-main.yml +++ b/.github/workflows/sync-main.yml @@ -4,7 +4,7 @@ on: schedule: - cron: '/10 * * * *' jobs: - check: + sync: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2