From 2a25e4f3aef22c87c049a45496b69852bdd15b95 Mon Sep 17 00:00:00 2001 From: Kim Morrison <477956+kim-em@users.noreply.github.com> Date: Sun, 22 Mar 2026 22:30:36 +1100 Subject: [PATCH] fix: nightly dispatch creates today's tag when retrying a failed nightly (#13035) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes the `workflow_dispatch` path for nightly releases. Previously, when a scheduled nightly failed (so no tag was created) and someone manually re-triggered the workflow, it would find the most recent existing nightly tag (from a previous day) and create a `-revK` revision of that old tag. Now it checks if today's nightly tag exists: if not, it creates it directly; if it already exists, it creates a `-revK` revision as before. 🤖 Prepared with Claude Code Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0e0ae0408..c3442d623f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,15 +61,19 @@ jobs: git remote add nightly https://foo:'${{ secrets.PUSH_NIGHTLY_TOKEN }}'@github.com/${{ github.repository_owner }}/lean4-nightly.git git fetch nightly --tags if [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then - # Manual re-release: create a revision of the most recent nightly - BASE_NIGHTLY=$(git tag -l 'nightly-*' | sort -rV | head -1) - # Strip any existing -revK suffix to get the base date tag - BASE_NIGHTLY="${BASE_NIGHTLY%%-rev*}" - REV=1 - while git rev-parse "refs/tags/${BASE_NIGHTLY}-rev${REV}" >/dev/null 2>&1; do - REV=$((REV + 1)) - done - LEAN_VERSION_STRING="${BASE_NIGHTLY}-rev${REV}" + # Manual re-release: retry today's nightly, or create a revision if it already exists + TODAY_NIGHTLY="nightly-$(date -u +%F)" + if git rev-parse "refs/tags/${TODAY_NIGHTLY}" >/dev/null 2>&1; then + # Today's nightly already exists, create a revision + REV=1 + while git rev-parse "refs/tags/${TODAY_NIGHTLY}-rev${REV}" >/dev/null 2>&1; do + REV=$((REV + 1)) + done + LEAN_VERSION_STRING="${TODAY_NIGHTLY}-rev${REV}" + else + # Today's nightly doesn't exist yet (e.g. scheduled run failed), create it + LEAN_VERSION_STRING="${TODAY_NIGHTLY}" + fi echo "nightly=$LEAN_VERSION_STRING" >> "$GITHUB_OUTPUT" else # Scheduled: do nothing if commit already has a different tag