fix: nightly dispatch creates today's tag when retrying a failed nightly (#13035)

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) <noreply@anthropic.com>
This commit is contained in:
Kim Morrison 2026-03-22 22:30:36 +11:00 committed by GitHub
parent 13f8ce8492
commit 2a25e4f3ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,15 +61,19 @@ jobs:
git remote add nightly https://foo:'${{ secrets.PUSH_NIGHTLY_TOKEN }}'@github.com/${{ github.repository_owner }}/lean4-nightly.git git remote add nightly https://foo:'${{ secrets.PUSH_NIGHTLY_TOKEN }}'@github.com/${{ github.repository_owner }}/lean4-nightly.git
git fetch nightly --tags git fetch nightly --tags
if [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then if [[ '${{ github.event_name }}' == 'workflow_dispatch' ]]; then
# Manual re-release: create a revision of the most recent nightly # Manual re-release: retry today's nightly, or create a revision if it already exists
BASE_NIGHTLY=$(git tag -l 'nightly-*' | sort -rV | head -1) TODAY_NIGHTLY="nightly-$(date -u +%F)"
# Strip any existing -revK suffix to get the base date tag if git rev-parse "refs/tags/${TODAY_NIGHTLY}" >/dev/null 2>&1; then
BASE_NIGHTLY="${BASE_NIGHTLY%%-rev*}" # Today's nightly already exists, create a revision
REV=1 REV=1
while git rev-parse "refs/tags/${BASE_NIGHTLY}-rev${REV}" >/dev/null 2>&1; do while git rev-parse "refs/tags/${TODAY_NIGHTLY}-rev${REV}" >/dev/null 2>&1; do
REV=$((REV + 1)) REV=$((REV + 1))
done done
LEAN_VERSION_STRING="${BASE_NIGHTLY}-rev${REV}" 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" echo "nightly=$LEAN_VERSION_STRING" >> "$GITHUB_OUTPUT"
else else
# Scheduled: do nothing if commit already has a different tag # Scheduled: do nothing if commit already has a different tag