From d6b1ec6f2f8887c6f913c9e6e6403c9b4b4c33da Mon Sep 17 00:00:00 2001 From: Demilade Sonuga Date: Fri, 3 Jan 2025 10:42:59 +0100 Subject: [PATCH] Add workflow to sync with upstream rust --- .../workflows/{dusk.yml => dusk-build.yml} | 0 .github/workflows/dusk-sync.yml | 43 +++++++++++++++++++ 2 files changed, 43 insertions(+) rename .github/workflows/{dusk.yml => dusk-build.yml} (100%) create mode 100644 .github/workflows/dusk-sync.yml diff --git a/.github/workflows/dusk.yml b/.github/workflows/dusk-build.yml similarity index 100% rename from .github/workflows/dusk.yml rename to .github/workflows/dusk-build.yml diff --git a/.github/workflows/dusk-sync.yml b/.github/workflows/dusk-sync.yml new file mode 100644 index 0000000000000..f65d94043095b --- /dev/null +++ b/.github/workflows/dusk-sync.yml @@ -0,0 +1,43 @@ +# Instructions for GitHub to sync the fork with upstream rust. + +name: Dusk Sync +on: + schedule: + - cron: '0 0 * * 0' + workflow_dispatch: + +jobs: + Dusk-Sync: + runs-on: ubuntu-24.04 + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Add Upstream + run: | + git remote add upstream https://github.com/rust-lang/rust.git + git fetch upstream + + - name: Set Up Git User + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Sync + run: | + LATEST_COMMON_COMMIT=$(git merge-base master upstream/stable) + STABLE_MASTER_BASE_COMMIT=$(git merge-base upstream/master upstream/stable) + if [ $LATEST_COMMON_COMMIT != $STABLE_MASTER_BASE_COMMIT ] + then + git checkout master + git merge $STABLE_MASTER_BASE_COMMIT + if [ $? -ne 0 ] + then + exit 1 + fi + git push + else + echo "Up to date" + fi