Skip to content

[GitHub Action] Enable periodically automatic sync for main branch from llvm-project to llvm #2898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/sync-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: automatic sync main branch from llvm-project to llvm

on:
schedule:
- cron: '*/10 * * * *'
jobs:
sync-main:
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
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 origin
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 origin
fi
echo "sync finished"
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details.

## DPC++ extensions




DPC++ is an open, cross-architecture language built upon the ISO C++ and Khronos
SYCL\* standards. DPC++ extends these standards with a number of extensions,
which can be found in [sycl/doc/extensions](sycl/doc/extensions) directory.
Expand Down