Fix: release workflow SHA sync to main with error logging
Some checks failed
Repo Health / Access control (push) Has been cancelled
Repo Health / Release configuration (push) Has been cancelled
Repo Health / Scripts governance (push) Has been cancelled
Repo Health / Repository health (push) Has been cancelled

- Remove duplicate TOKEN line
- API PUT: log HTTP response code and body on failure
- Log warning if file SHA lookup fails

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-04-19 00:53:51 -05:00
parent 481200dc02
commit 5dfc5ea158

View File

@@ -378,7 +378,6 @@ jobs:
VERSION="${{ steps.meta.outputs.version }}"
CURRENT_BRANCH="${{ github.ref_name }}"
TOKEN="${{ secrets.GA_TOKEN }}"
TOKEN="${{ secrets.GA_TOKEN }}"
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
git config --local user.name "gitea-actions[bot]"
@@ -402,10 +401,10 @@ jobs:
"${API}/contents/updates.xml?ref=main" | jq -r '.sha // empty')
if [ -n "$FILE_SHA" ]; then
# Base64-encode the updates.xml content
# Base64-encode the updates.xml content from working tree (has updated SHA)
CONTENT=$(base64 -w0 updates.xml)
curl -sf -X PUT -H "Authorization: token ${GA_TOKEN}" \
RESPONSE=$(curl -s -w "\n%{http_code}" -X PUT -H "Authorization: token ${GA_TOKEN}" \
-H "Content-Type: application/json" \
"${API}/contents/updates.xml" \
-d "$(jq -n \
@@ -414,7 +413,16 @@ jobs:
--arg msg "chore: update ${STABILITY} channel to ${VERSION} on main [skip ci]" \
--arg branch "main" \
'{content: $content, sha: $sha, message: $msg, branch: $branch}'
)" > /dev/null && echo "updates.xml synced to main via API" || echo "WARNING: failed to sync updates.xml to main"
)")
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "201" ]; then
echo "updates.xml synced to main via API (HTTP ${HTTP_CODE})"
else
echo "WARNING: failed to sync updates.xml to main (HTTP ${HTTP_CODE})"
echo "$RESPONSE" | head -5
fi
else
echo "WARNING: could not get file SHA for updates.xml on main"
fi
fi