Skip duplicate RC retries within same PT hour
This commit is contained in:
parent
3028ded572
commit
88f03af594
|
|
@ -65,6 +65,22 @@ jobs:
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# Why: the first scheduled run today used the earlier workflow before
|
||||
# slot markers existed. Keep a tag-time fallback so retries in the
|
||||
# same PT hour still skip if an RC tag was already created.
|
||||
latest_rc_tag="$(git for-each-ref --sort=-creatordate --format='%(refname:short) %(creatordate:iso-strict)' 'refs/tags/v*-rc.*' | head -n 1)"
|
||||
if [[ -n "$latest_rc_tag" ]]; then
|
||||
latest_rc_tag_name="${latest_rc_tag%% *}"
|
||||
latest_rc_tag_date="${latest_rc_tag#* }"
|
||||
latest_rc_slot="$(TZ=America/Los_Angeles date -d "$latest_rc_tag_date" '+%Y-%m-%d-%H')"
|
||||
|
||||
if [[ "$latest_rc_slot" == "${{ steps.slot.outputs.value }}" ]]; then
|
||||
echo "already_ran=true" >>"$GITHUB_OUTPUT"
|
||||
echo "reason=latest_rc_tag:$latest_rc_tag_name" >>"$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "already_ran=false" >>"$GITHUB_OUTPUT"
|
||||
|
||||
- name: Dry run summary
|
||||
|
|
@ -73,6 +89,7 @@ jobs:
|
|||
echo "Dry run only."
|
||||
echo "Current PT slot: ${{ steps.slot.outputs.value }}"
|
||||
echo "Already ran this slot: ${{ steps.existing.outputs.already_ran }}"
|
||||
echo "Reason: ${{ steps.existing.outputs.reason }}"
|
||||
|
||||
- name: Create and push RC tag
|
||||
if: steps.existing.outputs.already_ran != 'true' && !(github.event_name == 'workflow_dispatch' && inputs.dry_run)
|
||||
|
|
|
|||
Loading…
Reference in New Issue