Skip to content

Commit 7aaa3cd

Browse files
committed
fix: use CF_PURGE_TOKEN secret name to avoid org secret conflict
1 parent e035d85 commit 7aaa3cd

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

.github/workflows/test_cloudflare_purge.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
required: false
1111
type: string
1212
description: "Cloudflare API Token (overrides secret if provided)"
13+
default: ""
1314

1415
jobs:
1516
test_cloudflare_purge:
@@ -37,12 +38,16 @@ jobs:
3738
# Get raw values first (before any processing)
3839
RAW_ZONE_ID="${{ secrets.CLOUDFLARE_ZONE }}"
3940
40-
# Check if input token is provided (overrides secret)
41-
if [ -n "${{ inputs.cloudflare_auth_key }}" ]; then
42-
echo "✅ Using token from workflow input (overrides organization secret)"
41+
# Try repository-specific secret first (won't conflict with org secrets)
42+
# If not found, fall back to the standard name
43+
if [ -n "${{ secrets.CF_PURGE_TOKEN }}" ]; then
44+
echo "✅ Using token from repository secret: CF_PURGE_TOKEN"
45+
RAW_AUTH_TOKEN="${{ secrets.CF_PURGE_TOKEN }}"
46+
elif [ -n "${{ inputs.cloudflare_auth_key }}" ]; then
47+
echo "✅ Using token from workflow input"
4348
RAW_AUTH_TOKEN="${{ inputs.cloudflare_auth_key }}"
4449
else
45-
echo "Using token from secrets (may be from organization level)"
50+
echo "Using token from CLOUDFLARE_AUTH_KEY (may be from organization level)"
4651
RAW_AUTH_TOKEN="${{ secrets.CLOUDFLARE_AUTH_KEY }}"
4752
4853
# Check if we're reading the old token (from org secrets)
@@ -52,16 +57,16 @@ jobs:
5257
echo " Token starts with: ${RAW_AUTH_TOKEN:0:3}"
5358
echo " This is the OLD token that should be deleted."
5459
echo ""
55-
echo "The organization secret is overriding your repository secret."
60+
echo "SOLUTION: Create a repository secret named 'CF_PURGE_TOKEN' with your new token:"
61+
echo "1. Go to: Settings → Secrets and variables → Actions"
62+
echo "2. Click 'New repository secret'"
63+
echo "3. Name: CF_PURGE_TOKEN"
64+
echo "4. Value: Your new token (starting with 'fjx')"
65+
echo "5. Click 'Add secret'"
5666
echo ""
57-
echo "SOLUTIONS:"
58-
echo "1. Ask an org admin to delete CLOUDFLARE_AUTH_KEY from org secrets"
59-
echo "2. OR use workflow_dispatch with input parameter to override:"
60-
echo " - Go to Actions → Test Cloudflare Cache Purge → Run workflow"
61-
echo " - Enter your NEW token (starting with 'fjx') in 'cloudflare_auth_key' field"
62-
echo " - This will override the org secret"
67+
echo "This secret name won't conflict with organization secrets."
6368
echo ""
64-
echo "❌ Cannot proceed with old token. Please use workflow_dispatch with token input."
69+
echo "❌ Cannot proceed with old token. Please create CF_PURGE_TOKEN secret."
6570
exit 1
6671
fi
6772
fi

0 commit comments

Comments
 (0)