Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions release-hold/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ runs:
REPO: ${{ inputs.repository }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_REF_TYPE: ${{ github.ref_type }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail

Expand Down Expand Up @@ -147,8 +148,20 @@ runs:
;;
esac

# Calculate age
ANCHOR_EPOCH=$(date -d "$TIMESTAMP" +%s)
# Parse ISO-8601 timestamps portably across GitHub-hosted runners.
PYTHON_BIN="${PYTHON_BIN:-}"
if [ -z "$PYTHON_BIN" ]; then
if command -v python3 >/dev/null 2>&1; then
PYTHON_BIN=python3
elif command -v python >/dev/null 2>&1; then
PYTHON_BIN=python
else
echo "❌ Error: python3 or python is required to parse timestamps"
exit 1
fi
fi

ANCHOR_EPOCH=$("$PYTHON_BIN" -c 'import datetime, sys; print(int(datetime.datetime.fromisoformat(sys.argv[1].replace("Z", "+00:00")).timestamp()))' "$TIMESTAMP")
NOW_EPOCH=$(date +%s)
AGE_MINUTES=$(( (NOW_EPOCH - ANCHOR_EPOCH) / 60 ))

Expand Down