Skip to content

Commit 4806e91

Browse files
authored
Merge pull request #36 from SentienceAPI/fix_release6
more robust sync
2 parents 442df3e + 274d866 commit 4806e91

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

.github/workflows/sync-extension.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,25 +74,32 @@ jobs:
7474
7575
# Capture response to file for debugging
7676
# Use -f to fail on HTTP errors (404/403) so we don't parse error HTML
77-
curl -s -f -H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
78-
"https://api.github.com/repos/$REPO/releases/tags/$TAG" > release.json || {
79-
echo "❌ Failed to fetch release info. Response:"
80-
cat release.json || echo "(No response body)"
81-
exit 1
82-
}
77+
# We explicitly print the response body on failure for debugging
78+
HTTP_CODE=$(curl -s -w "%{http_code}" -o release.json \
79+
-H "Authorization: token ${{ secrets.SENTIENCE_CHROME_TOKEN }}" \
80+
"https://api.github.com/repos/$REPO/releases/tags/$TAG")
8381
84-
# Check if we got a valid release object (sanity check)
82+
if [ "$HTTP_CODE" != "200" ]; then
83+
echo "❌ Failed to fetch release info. HTTP Code: $HTTP_CODE"
84+
echo "Response Body:"
85+
cat release.json
86+
exit 1
87+
fi
88+
89+
# Check if we got a valid release object (sanity check for "Not Found" message)
8590
if grep -q "Not Found" release.json; then
86-
echo "❌ Critical Error: Release tag $TAG not found in repo $REPO"
91+
echo "❌ Critical Error: Release tag $TAG not found in repo $REPO (API returned 404 message)"
92+
cat release.json
8793
exit 1
8894
fi
8995
9096
# Robust extraction with safe navigation operator
97+
# The ? prevents jq from crashing if .assets is missing/null
9198
ASSET_URL=$(cat release.json | jq -r '.assets[]? | select(.name == "extension-files.tar.gz") | .browser_download_url')
9299
93100
if [ -z "$ASSET_URL" ] || [ "$ASSET_URL" == "null" ]; then
94101
echo "❌ Critical Error: extension-files.tar.gz not found in release assets!"
95-
echo "Available assets:"
102+
echo "Available assets in release:"
96103
cat release.json | jq -r '.assets[].name' || echo "No assets found or invalid JSON"
97104
exit 1
98105
fi

0 commit comments

Comments
 (0)