diff --git a/release-hold/action.yml b/release-hold/action.yml index ccc154d..a6b79f6 100644 --- a/release-hold/action.yml +++ b/release-hold/action.yml @@ -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 @@ -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 ))