Skip to content

Commit 3f58aa3

Browse files
authored
Add a GitHub workflow cache to manually purge the Cloudflare cache (#2094)
## Changes - Adds a workflow definition to manually trigger a Cloudflare purge ## Context In #2086, and then also in #2093, we saw problems where the cache-purging logic that is supposed to be run as part of deploying the site seems not to have worked as expected. The symptom is that the CSS (whose file name now changes when its contents change) isn't loading, because the front-page still serves an older version (one that references a no-longer-existing CSS). Let's add a way to manually purge the cache. It is totally possible that this is one of those [famous "Close Door" elevator buttons](https://www.sciencealert.com/the-close-door-buttons-in-elevators-don-t-actually-do-anything) that fool us into believing that we did something, _anything_. But _just_ in case it isn't such a no-op, let's have a GitHub workflow so that we can trigger a Cloudflare cache purge manually. [Here](https://github.com/git/git-scm.com/actions/runs/18134159656/job/51608395791) is the workflow run that I would like to believe fixed the issue.
2 parents 509bc61 + e39b10f commit 3f58aa3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/purge-cache.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Purge Cloudflare Cache
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
purge-cache:
8+
concurrency:
9+
group: "purge-cache"
10+
cancel-in-progress: false
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Purge Cloudflare cache
14+
shell: bash
15+
env:
16+
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}
17+
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
18+
if: env.CLOUDFLARE_TOKEN != ''
19+
run: |
20+
curl "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE/purge_cache" \
21+
-H "Authorization: Bearer $CLOUDFLARE_TOKEN" \
22+
-H "Content-Type: application/json" \
23+
-d '{ "purge_everything": true }'
24+
25+

0 commit comments

Comments
 (0)