From d461939b1ab85ed8763447383d26953d98dcfdd1 Mon Sep 17 00:00:00 2001 From: Diego Ripley Date: Thu, 26 Jun 2025 18:16:26 -0400 Subject: [PATCH] Change GitHub action so it purges the Cloudflare cache for www.dataforcanada.org and enables running workflow manually from the Actions tab --- .github/workflows/deploy_worker.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_worker.yaml b/.github/workflows/deploy_worker.yaml index 6fc7436..f84fca2 100644 --- a/.github/workflows/deploy_worker.yaml +++ b/.github/workflows/deploy_worker.yaml @@ -5,6 +5,8 @@ on: - main paths: - 'worker/*' + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. concurrency: @@ -23,4 +25,10 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN_WORKER }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - workingDirectory: "worker" \ No newline at end of file + workingDirectory: "worker" + - name: Purge Cloudflare cache + run: | + curl --location 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache' \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN_PURGE_CACHE }}' \ + --data '{"hosts": ["www.dataforcanada.org"]}'