From 140d51f18139e4e16430310219809cb9b9e9c96b Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Fri, 19 Dec 2025 17:13:58 -0500 Subject: [PATCH] Debug workflow --- .forgejo/workflows/release.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index d3b7084..a503acb 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -46,10 +46,20 @@ jobs: env: FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} run: | + echo "Token present: ${FORGEJO_TOKEN:+yes}" + echo "Token length: ${#FORGEJO_TOKEN}" + TAG="${{ github.event.inputs.tag || github.ref_name }}" API_BASE="${{ github.server_url }}/api/v1" REPO="${{ github.repository }}" + # ensure tag exists (create at HEAD if not) + curl -s -X POST \ + -H "Authorization: token ${FORGEJO_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\": \"${TAG}\"}" \ + "${API_BASE}/repos/${REPO}/tags" || true + # get or create release echo "Looking for release: ${API_BASE}/repos/${REPO}/releases/tags/${TAG}" RESPONSE=$(curl -s -H "Authorization: token ${FORGEJO_TOKEN}" \ @@ -59,13 +69,15 @@ jobs: if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then echo "Creating release for ${TAG}..." - RESPONSE=$(curl -s -X POST \ + JSON_PAYLOAD=$(printf '{"tag_name": "%s", "name": "%s"}' "$TAG" "$TAG") + echo "Payload: ${JSON_PAYLOAD}" + RESPONSE=$(curl -sv -X POST \ -H "Authorization: token ${FORGEJO_TOKEN}" \ -H "Content-Type: application/json" \ - -d "{\"tag_name\": \"${TAG}\", \"name\": \"${TAG}\"}" \ - "${API_BASE}/repos/${REPO}/releases") - echo "Create response: ${RESPONSE}" - RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id') + -d "$JSON_PAYLOAD" \ + "${API_BASE}/repos/${REPO}/releases" 2>&1) + echo "Full response: ${RESPONSE}" + RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) fi echo "Release ID: ${RELEASE_ID}"