From fbf3c3286ac2af1969a5514bb6f585857eb5d352 Mon Sep 17 00:00:00 2001 From: Eric Scouten Date: Sun, 29 Sep 2024 11:36:07 -0700 Subject: [PATCH] chore: Don't update nightly after push to main if we're expecting a release branch shortly --- .github/workflows/nightly.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9df5c95..640470b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -96,11 +96,19 @@ jobs: if [[ "$OLD_BASE_COMMIT" == "$NEW_BASE_COMMIT" && "$GH_EVENT_NAME" == "pull_request" ]]; then echo "Nightly already points to same base; leave unchanged"; echo "base-commit=skip" >> "$GITHUB_OUTPUT" - else - echo "Updating nightly base"; - echo "base-commit=$NEW_BASE_COMMIT" >> "$GITHUB_OUTPUT" + exit 0 + elif [[ "$GH_EVENT_NAME" == "push" ]]; then + LATEST_TAG=$(git describe --tags --abbrev=0) + if ![[ git --no-pager log $LATEST_TAG..head --pretty=format:"%s" | grep -v "^chore" ]]; + echo "Found non-chore commits on main since last commit; leave unchanged" + echo "(Expecting release-plz to create a new release branch)" + echo "base-commit=skip" >> "$GITHUB_OUTPUT" + exit 0 fi + echo "Updating nightly base"; + echo "base-commit=$NEW_BASE_COMMIT" >> "$GITHUB_OUTPUT" + - name: Install Rust toolchain if: ${{ steps.choose-base.outputs.base-commit != 'skip' }} uses: dtolnay/rust-toolchain@stable