Skip to content

Merge pull request #147 from Savirius/master #7

Merge pull request #147 from Savirius/master

Merge pull request #147 from Savirius/master #7

Workflow file for this run

name: Purge cache on markers update
on:
push:
branches:
- master
jobs:
purge-cache:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Filter markers.js files
uses: dorny/paths-filter@v3
id: filter
with:
list-files: json
filters: |
markers:
- '**/markers.js'
- name: Format files list
id: format
if: steps.filter.outputs.markers == 'true'
run: |
echo FILES_JSON=$(echo '${{ steps.filter.outputs.markers_files }}' | jq '. | map("https://gitcdn.dinip.pt/Dinip/hermitcraft/master/" + .)') >> $GITHUB_ENV
- name: Purge Cloudflare cache
if: steps.filter.outputs.markers == 'true'
run: |
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-d "{\"files\": $FILES_JSON}" \
"https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_IDENTIFIER }}/purge_cache"