fix: update organization existence check and enhance Gitea Actions API accessibility verification
This commit is contained in:
@@ -55,15 +55,15 @@ run_check "API token valid (returns correct username)" check_token
|
|||||||
run_check "Organization '${GITEA_ORG_NAME}' exists" \
|
run_check "Organization '${GITEA_ORG_NAME}' exists" \
|
||||||
curl -sf -o /dev/null -H "Authorization: token ${GITEA_ADMIN_TOKEN}" "${GITEA_INTERNAL_URL}/api/v1/orgs/${GITEA_ORG_NAME}"
|
curl -sf -o /dev/null -H "Authorization: token ${GITEA_ADMIN_TOKEN}" "${GITEA_INTERNAL_URL}/api/v1/orgs/${GITEA_ORG_NAME}"
|
||||||
|
|
||||||
# Check 5: Gitea Actions enabled (verify via settings API)
|
# Check 5: Gitea Actions admin runners API is accessible
|
||||||
# shellcheck disable=SC2329
|
# shellcheck disable=SC2329
|
||||||
check_actions() {
|
check_actions() {
|
||||||
# The /api/v1/settings/api endpoint returns instance settings.
|
local response
|
||||||
# If Actions are enabled, the Gitea instance will accept runner registrations.
|
response=$(curl -sf -H "Authorization: token ${GITEA_ADMIN_TOKEN}" "${GITEA_INTERNAL_URL}/api/v1/admin/runners")
|
||||||
# We can also check by simply verifying the admin/runners endpoint responds.
|
# Endpoint should return a JSON array (possibly empty) when available.
|
||||||
curl -sf -H "Authorization: token ${GITEA_ADMIN_TOKEN}" "${GITEA_INTERNAL_URL}/api/v1/settings/api" -o /dev/null
|
printf '%s' "$response" | jq -e 'type == "array"' >/dev/null
|
||||||
}
|
}
|
||||||
run_check "Gitea API settings accessible (Actions check)" check_actions
|
run_check "Gitea Actions admin runners API accessible" check_actions
|
||||||
|
|
||||||
# Summary
|
# Summary
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|||||||
Reference in New Issue
Block a user