More CICD fixes again again again
Some checks failed
CICD Start / Sanity and Base Decision (pull_request) Failing after 10s
Some checks failed
CICD Start / Sanity and Base Decision (pull_request) Failing after 10s
Signed-off-by: copilotcoder <copilotcoder@darkhelm.org>
This commit is contained in:
@@ -130,14 +130,50 @@ jobs:
|
||||
dispatched=false
|
||||
for API_BASE in "${CANDIDATE_API_BASES[@]}"; do
|
||||
DISPATCH_URL="${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/actions/workflows/${TARGET_WORKFLOW}/dispatches"
|
||||
RESPONSE_FILE="/tmp/dispatch-response.txt"
|
||||
: > "${RESPONSE_FILE}"
|
||||
|
||||
HTTP_CODE=$(curl -sS --connect-timeout 5 --max-time 20 -o "${RESPONSE_FILE}" -w "%{http_code}" -X POST \
|
||||
-H "Authorization: token ${DISPATCH_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${DISPATCH_URL}" \
|
||||
-d "${payload}" || true)
|
||||
HTTP_RESULT=$(
|
||||
printf '%s\n' \
|
||||
'import os' \
|
||||
'import sys' \
|
||||
'import urllib.error' \
|
||||
'import urllib.request' \
|
||||
'' \
|
||||
'url = os.environ["DISPATCH_URL"]' \
|
||||
'token = os.environ["DISPATCH_TOKEN"]' \
|
||||
'payload = os.environ["DISPATCH_PAYLOAD"]' \
|
||||
'' \
|
||||
'request = urllib.request.Request(' \
|
||||
' url,' \
|
||||
' data=payload.encode("utf-8"),' \
|
||||
' headers={' \
|
||||
' "Authorization": "token " + token,' \
|
||||
' "Content-Type": "application/json" ,' \
|
||||
' "User-Agent": "plex-playlist-cicd-start" ,' \
|
||||
' },' \
|
||||
' method="POST",' \
|
||||
')' \
|
||||
'' \
|
||||
'try:' \
|
||||
' with urllib.request.urlopen(request, timeout=20) as response:' \
|
||||
' sys.stdout.write(f"{response.status}\\n")' \
|
||||
' body = response.read().decode("utf-8", "replace")' \
|
||||
' if body:' \
|
||||
' sys.stdout.write(body)' \
|
||||
'except urllib.error.HTTPError as error:' \
|
||||
' sys.stdout.write(f"{error.code}\\n")' \
|
||||
' body = error.read().decode("utf-8", "replace")' \
|
||||
' if body:' \
|
||||
' sys.stdout.write(body)' \
|
||||
'except Exception as error:' \
|
||||
' sys.stdout.write(f"000\\n{error}\\n")' \
|
||||
| DISPATCH_URL="${DISPATCH_URL}" \
|
||||
DISPATCH_TOKEN="${DISPATCH_TOKEN}" \
|
||||
DISPATCH_PAYLOAD="${payload}" \
|
||||
python3 -
|
||||
)
|
||||
|
||||
HTTP_CODE=$(printf '%s\n' "${HTTP_RESULT}" | sed -n '1p')
|
||||
RESPONSE_BODY=$(printf '%s\n' "${HTTP_RESULT}" | sed '1d')
|
||||
|
||||
if [ "${HTTP_CODE}" -ge 200 ] && [ "${HTTP_CODE}" -lt 300 ]; then
|
||||
echo "✓ Dispatch succeeded via ${API_BASE}"
|
||||
@@ -146,9 +182,9 @@ jobs:
|
||||
fi
|
||||
|
||||
echo "Dispatch attempt failed via ${API_BASE} (HTTP ${HTTP_CODE})"
|
||||
if [ -s "${RESPONSE_FILE}" ]; then
|
||||
if [ -n "${RESPONSE_BODY}" ]; then
|
||||
echo "Response body:"
|
||||
cat "${RESPONSE_FILE}"
|
||||
printf '%s\n' "${RESPONSE_BODY}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user