Skip to content

Commit 09d2ce2

Browse files
committed
debug: add raw secret inspection to verify token value
1 parent eb9c10b commit 09d2ce2

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

.github/workflows/test_cloudflare_purge.yml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,53 @@ jobs:
2020
2121
- name: Verify Cloudflare Token
2222
run: |
23-
ZONE_ID=$(echo "${{ secrets.CLOUDFLARE_ZONE }}" | tr -d '[:space:]')
24-
AUTH_TOKEN=$(echo "${{ secrets.CLOUDFLARE_AUTH_KEY }}" | tr -d '[:space:]')
23+
# Get raw values first (before any processing)
24+
RAW_ZONE_ID="${{ secrets.CLOUDFLARE_ZONE }}"
25+
RAW_AUTH_TOKEN="${{ secrets.CLOUDFLARE_AUTH_KEY }}"
2526
26-
echo "=== Token Diagnostics ==="
27+
echo "=== Raw Secret Inspection ==="
28+
echo "Raw Zone ID length: ${#RAW_ZONE_ID}"
29+
echo "Raw Token length: ${#RAW_AUTH_TOKEN}"
30+
echo "Raw Token first 10 chars (hex): $(echo -n "$RAW_AUTH_TOKEN" | head -c 10 | xxd -p 2>/dev/null || echo 'xxd not available')"
31+
echo "Raw Token first 10 chars (visible): $(echo -n "$RAW_AUTH_TOKEN" | head -c 10 | cat -A)"
32+
33+
# Process values (trim whitespace)
34+
ZONE_ID=$(echo "$RAW_ZONE_ID" | tr -d '[:space:]')
35+
AUTH_TOKEN=$(echo "$RAW_AUTH_TOKEN" | tr -d '[:space:]')
36+
37+
echo ""
38+
echo "=== After Processing ==="
2739
echo "Zone ID length: ${#ZONE_ID}"
2840
echo "Zone ID: ${ZONE_ID:0:8}...${ZONE_ID: -8}"
2941
echo "Token length: ${#AUTH_TOKEN}"
3042
3143
# Show token preview more safely
3244
if [ ${#AUTH_TOKEN} -ge 15 ]; then
33-
TOKEN_START="${AUTH_TOKEN:0:8}"
34-
TOKEN_END="${AUTH_TOKEN: -8}"
45+
TOKEN_START="${AUTH_TOKEN:0:10}"
46+
TOKEN_END="${AUTH_TOKEN: -10}"
3547
echo "Token preview: ${TOKEN_START}...${TOKEN_END}"
48+
echo "Token starts with: ${AUTH_TOKEN:0:3}"
49+
echo "Token ends with: ${AUTH_TOKEN: -3}"
3650
else
3751
echo "⚠️ WARNING: Token seems too short (${#AUTH_TOKEN} chars). API tokens are typically 40+ characters."
3852
echo "Token preview: ${AUTH_TOKEN:0:4}...${AUTH_TOKEN: -4}"
3953
fi
4054
55+
# Check if token matches expected start
56+
if [ "${AUTH_TOKEN:0:3}" != "fjx" ]; then
57+
echo ""
58+
echo "⚠️ WARNING: Token does not start with 'fjx' as expected!"
59+
echo " Expected: starts with 'fjx'"
60+
echo " Actual: starts with '${AUTH_TOKEN:0:3}'"
61+
echo ""
62+
echo "This suggests the GitHub secret may not have been updated correctly."
63+
echo "Please verify:"
64+
echo "1. Go to: Settings → Secrets and variables → Actions"
65+
echo "2. Check CLOUDFLARE_AUTH_KEY value"
66+
echo "3. Make sure you saved the secret after updating it"
67+
echo "4. Wait a few seconds for GitHub to propagate the secret"
68+
fi
69+
4170
# Check token type hints
4271
if [ ${#AUTH_TOKEN} -lt 45 ]; then
4372
echo ""

0 commit comments

Comments
 (0)