fix(ci): checkout repository in prepare job to fix priority-gate execution crash
Some checks failed
Build & Deploy / 🔍 Prepare (push) Failing after 25s
Build & Deploy / 🧪 QA (push) Has been skipped
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Failing after 25s
Build & Deploy / 🧪 QA (push) Has been skipped
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Bypassing priority gate for debug."
|
||||
env | grep "CURRENT\|GITEA\|GITHUB"
|
||||
exit 0
|
||||
if [ -z "$GITEA_PAT" ]; then
|
||||
echo "No GITEA_PAT provided, skipping priority gate."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$CURRENT_RUN_ID" ] || [ -z "$CURRENT_TARGET" ] || [ -z "$GITHUB_REPOSITORY" ]; then
|
||||
echo "Missing required environment variables. CURRENT_RUN_ID=$CURRENT_RUN_ID, CURRENT_TARGET=$CURRENT_TARGET, GITHUB_REPOSITORY=$GITHUB_REPOSITORY"
|
||||
# Don't fail the build just because target is empty (e.g. skip targets) or env vars are missing during PRs
|
||||
echo "Bypassing priority gate gracefully."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
declare -A PRIO=( ["production"]=40 ["staging"]=30 ["testing"]=20 ["branch"]=10 )
|
||||
CURRENT_PRIO=${PRIO[$CURRENT_TARGET]:-0}
|
||||
|
||||
echo "Current Run: $CURRENT_RUN_ID, Target: $CURRENT_TARGET, Priority: $CURRENT_PRIO"
|
||||
|
||||
@@ -13,11 +24,12 @@ API_BASE="https://git.infra.mintel.me/api/v1/repos/$GITHUB_REPOSITORY/actions/ru
|
||||
LIMIT=50
|
||||
RESPONSE=$(curl -s -H "Authorization: token $GITEA_PAT" "$API_BASE?limit=$LIMIT")
|
||||
|
||||
# Verify response is valid JSON
|
||||
if ! echo "$RESPONSE" | jq empty 2>/dev/null; then
|
||||
echo "Failed to parse API response from Gitea."
|
||||
# Verify response is a valid JSON array
|
||||
if ! echo "$RESPONSE" | jq -e 'type == "array"' >/dev/null 2>&1; then
|
||||
echo "Failed to parse API response from Gitea (not an array) or API error."
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
echo "Bypassing priority gate gracefully."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Use jq to extract running or waiting jobs that are NOT the current one
|
||||
|
||||
Reference in New Issue
Block a user