fix: refactor organization creation payload to use jq for JSON formatting

This commit is contained in:
S
2026-03-02 13:05:22 -05:00
parent ab1d781ccc
commit a7555d65cb

View File

@@ -213,10 +213,14 @@ log_step 9 "Creating organization '${GITEA_ORG_NAME}'..."
if curl -sf -H "Authorization: token ${GITEA_ADMIN_TOKEN}" "${GITEA_INTERNAL_URL}/api/v1/orgs/${GITEA_ORG_NAME}" -o /dev/null 2>/dev/null; then
log_info "Organization already exists — skipping"
else
ORG_PAYLOAD=$(jq -n \
--arg username "$GITEA_ORG_NAME" \
--arg full_name "$GITEA_INSTANCE_NAME" \
'{username: $username, full_name: $full_name, visibility: "public"}')
curl -sf -X POST \
-H "Authorization: token ${GITEA_ADMIN_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"username\":\"${GITEA_ORG_NAME}\",\"full_name\":\"${GITEA_INSTANCE_NAME}\",\"visibility\":\"public\"}" \
-d "$ORG_PAYLOAD" \
"${GITEA_INTERNAL_URL}/api/v1/orgs" -o /dev/null
if curl -sf -H "Authorization: token ${GITEA_ADMIN_TOKEN}" "${GITEA_INTERNAL_URL}/api/v1/orgs/${GITEA_ORG_NAME}" -o /dev/null 2>/dev/null; then