Sync with upstream #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Sync with upstream" | |
on: | |
schedule: | |
- cron: 20 4 * * * | |
workflow_dispatch: | |
env: | |
REMOTE_URL: https://github.com/vllm-project/vllm | |
REMOTE: upstream | |
BRANCH: main | |
jobs: | |
upstream-sync: | |
name: Sync with upstream | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch upstream repo | |
run: | | |
git remote add $REMOTE ${REMOTE_URL} | |
git fetch $REMOTE | |
- name: Check diff | |
id: diff | |
shell: bash | |
run: | | |
echo 'diff<<EOF' >> $GITHUB_OUTPUT | |
git diff --stat $REMOTE/$BRANCH | tee -a >(cat >> $GITHUB_OUTPUT) | |
echo 'EOF' >> $GITHUB_OUTPUT | |
- name: Sync with upstream | |
id: sync | |
if: ${{ steps.diff.outputs.diff != '' }} | |
run: | | |
set -vx | |
git_hash="$(git rev-parse ${REMOTE}/${BRANCH})" | |
echo "git_hash=$git_hash" >> $GITHUB_OUTPUT | |
git_describe="$(git describe --tags ${REMOTE}/${BRANCH})" | |
echo "git_describe=$git_describe" >> $GITHUB_OUTPUT | |
echo 'commits<<EOF' >> $GITHUB_OUTPUT | |
git log --oneline ..${REMOTE}/${BRANCH} >> $GITHUB_OUTPUT | |
echo 'EOF' >> $GITHUB_OUTPUT | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub" | |
git merge --no-commit --no-ff $REMOTE/$BRANCH | |
commit_message="Sync with upstream @ $git_describe" | |
echo commit_message="${commit_message}" >> $GITHUB_OUTPUT | |
git commit -m "$commit_message" --no-edit | |
- name: Create PR | |
if: ${{ steps.diff.outputs.diff != '' }} | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ github.token }} | |
commit-message: ${{ steps.sync.outputs.commit_message }} | |
title: Sync with Upstream | |
labels: | | |
code-sync | |
body: | | |
Sync with upstream @ ${{ steps.sync.outputs.git_describe }} (https://github.com/vllm-project/vllm/commit/${{ steps.sync.outputs.git_hash }}) | |
Commit list: | |
```console | |
${{ steps.sync.outputs.commits }} | |
``` | |
branch: sync-with-upstream |