Skip to content

Commit be58d50

Browse files
committed
Enhance GitHub Actions workflow for syncing downloads to PostHog
Added debugging information to check environment variables and set a default value for POSTHOG_HOST if not provided. Improved error handling by logging the response body on failure.
1 parent 9c031d3 commit be58d50

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/sync-github-downloads.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ jobs:
1616
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1818
run: |
19+
# 调试:检查环境变量(不显示完整 key)
20+
echo "POSTHOG_HOST: ${POSTHOG_HOST}"
21+
echo "POSTHOG_API_KEY length: ${#POSTHOG_API_KEY}"
22+
echo "POSTHOG_API_KEY prefix: ${POSTHOG_API_KEY:0:5}..."
23+
24+
# 如果 POSTHOG_HOST 没有设置,使用默认值
25+
if [ -z "$POSTHOG_HOST" ]; then
26+
POSTHOG_HOST="https://us.i.posthog.com"
27+
echo "Using default POSTHOG_HOST: ${POSTHOG_HOST}"
28+
fi
1929
# 获取所有 releases
2030
releases=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \
2131
"https://api.github.com/repos/mantra-hq/mantra-releases/releases?per_page=100")
@@ -78,11 +88,13 @@ jobs:
7888
}")
7989
8090
http_code=$(echo "$response" | tail -1)
91+
response_body=$(echo "$response" | head -n -1)
8192
8293
if [ "$http_code" = "200" ]; then
8394
echo " ✓ ${asset_name}: ${download_count} downloads (${platform}/${arch})"
8495
else
8596
echo " ✗ Failed: ${asset_name} (HTTP ${http_code})"
97+
echo " Response: ${response_body}"
8698
fi
8799
done
88100
done

0 commit comments

Comments
 (0)