do not automatically force deploy if previous redeploy was within the last 2 hours
This commit is contained in:
10
.github/scripts/check.sh
vendored
10
.github/scripts/check.sh
vendored
@@ -109,6 +109,16 @@ force_redeploy_registry () {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local latest_date_ts_seconds
|
||||||
|
latest_date_ts_seconds=$(echo "${latest_res}" | jq '.deployments[0].createdAt/1000|floor)')
|
||||||
|
local current_date_ts_seconds
|
||||||
|
current_date_ts_seconds="$(date +%s)"
|
||||||
|
local max_redeploy_interval_seconds=7200 # 2 hours
|
||||||
|
if (( current_date_ts_seconds - latest_date_ts_seconds < max_redeploy_interval_seconds )); then
|
||||||
|
echo "Last deployment was less than 2 hours ago. Skipping redeployment."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
local redeploy_res
|
local redeploy_res
|
||||||
redeploy_res=$(curl -X POST "https://api.vercel.com/v13/deployments?forceNew=1&skipAutoDetectionConfirmation=1&slug=$VERCEL_TEAM_SLUG&teamId=$VERCEL_TEAM_ID" \
|
redeploy_res=$(curl -X POST "https://api.vercel.com/v13/deployments?forceNew=1&skipAutoDetectionConfirmation=1&slug=$VERCEL_TEAM_SLUG&teamId=$VERCEL_TEAM_ID" \
|
||||||
--fail \
|
--fail \
|
||||||
|
|||||||
Reference in New Issue
Block a user