|
5 | 5 | branches: |
6 | 6 | - test-cloudflare-purge |
7 | 7 | workflow_dispatch: |
| 8 | + inputs: |
| 9 | + cloudflare_auth_key: |
| 10 | + required: false |
| 11 | + type: string |
| 12 | + description: "Cloudflare API Token (overrides secret if provided)" |
8 | 13 |
|
9 | 14 | jobs: |
10 | 15 | test_cloudflare_purge: |
|
31 | 36 | run: | |
32 | 37 | # Get raw values first (before any processing) |
33 | 38 | RAW_ZONE_ID="${{ secrets.CLOUDFLARE_ZONE }}" |
34 | | - RAW_AUTH_TOKEN="${{ secrets.CLOUDFLARE_AUTH_KEY }}" |
| 39 | + |
| 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)" |
| 43 | + RAW_AUTH_TOKEN="${{ inputs.cloudflare_auth_key }}" |
| 44 | + else |
| 45 | + echo "Using token from secrets (may be from organization level)" |
| 46 | + RAW_AUTH_TOKEN="${{ secrets.CLOUDFLARE_AUTH_KEY }}" |
| 47 | + |
| 48 | + # Check if we're reading the old token (from org secrets) |
| 49 | + if [ -n "$RAW_AUTH_TOKEN" ] && [ "${RAW_AUTH_TOKEN:0:3}" = "ObW" ]; then |
| 50 | + echo "" |
| 51 | + echo "⚠️ WARNING: Reading OLD token from organization secrets!" |
| 52 | + echo " Token starts with: ${RAW_AUTH_TOKEN:0:3}" |
| 53 | + echo " This is the OLD token that should be deleted." |
| 54 | + echo "" |
| 55 | + echo "The organization secret is overriding your repository secret." |
| 56 | + 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" |
| 63 | + echo "" |
| 64 | + echo "❌ Cannot proceed with old token. Please use workflow_dispatch with token input." |
| 65 | + exit 1 |
| 66 | + fi |
| 67 | + fi |
| 68 | + |
| 69 | + # Check if token is empty |
| 70 | + if [ -z "$RAW_AUTH_TOKEN" ]; then |
| 71 | + echo "❌ ERROR: CLOUDFLARE_AUTH_KEY is empty!" |
| 72 | + echo "" |
| 73 | + echo "SOLUTION: Use workflow_dispatch and provide the token as an input:" |
| 74 | + echo "1. Go to Actions → Test Cloudflare Cache Purge → Run workflow" |
| 75 | + echo "2. Enter your token in 'cloudflare_auth_key' field" |
| 76 | + echo "3. Click 'Run workflow'" |
| 77 | + exit 1 |
| 78 | + fi |
35 | 79 | |
36 | 80 | echo "=== Raw Secret Inspection ===" |
37 | 81 | echo "Raw Zone ID length: ${#RAW_ZONE_ID}" |
|
0 commit comments