From 554c0dd7187b18f529e75044656206078dcdac88 Mon Sep 17 00:00:00 2001 From: erweiw Date: Thu, 26 Feb 2026 14:51:30 -0800 Subject: [PATCH] Skip nightly wheel builds when no new commits exist The nightly cron was building and publishing wheels every day even when no commits had landed, causing duplicate wheels to accumulate in the latest-wheels release (e.g. the same commit built 4 days in a row). Add a check-changes gate job that inspects git history for commits in the last 25 hours. When triggered by schedule and no new commits are found, the build-wheels job is skipped. All other triggers (PR, tag push, workflow_dispatch, merge_group) bypass the check and always build. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/nightly-wheels.yml | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/nightly-wheels.yml b/.github/workflows/nightly-wheels.yml index 75fd28a..863c3df 100644 --- a/.github/workflows/nightly-wheels.yml +++ b/.github/workflows/nightly-wheels.yml @@ -27,8 +27,40 @@ concurrency: cancel-in-progress: true jobs: + check-changes: + name: Check for new commits + runs-on: ubuntu-latest + if: github.event_name == 'schedule' + outputs: + has_new_commits: ${{ steps.check.outputs.has_new_commits }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check for commits in last 24 hours + id: check + run: | + # Check if there are any commits in the last 25 hours + # (25h instead of 24h to add a buffer for cron scheduling jitter) + RECENT_COMMITS=$(git log --oneline --since="25 hours ago" HEAD) + if [ -z "$RECENT_COMMITS" ]; then + echo "No new commits in the last 25 hours. Skipping wheel build." + echo "has_new_commits=false" >> $GITHUB_OUTPUT + else + echo "New commits found:" + echo "$RECENT_COMMITS" + echo "has_new_commits=true" >> $GITHUB_OUTPUT + fi + build-wheels: name: Build triton wheel (Python ${{ matrix.python_version }}) + needs: [check-changes] + if: >- + always() && + (needs.check-changes.result == 'skipped' || + needs.check-changes.outputs.has_new_commits == 'true') runs-on: ubuntu-latest