ci: clear Firefox cache daily (#11802)

This commit is contained in:
Alex Rudenko 2024-02-01 10:33:52 +01:00 committed by GitHub
parent 56a2de04e1
commit fa353d3a59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,9 @@
name: Clear cache
on:
schedule:
# Run everyday at: https://crontab.guru/#0_6_*_*_*.
- cron: '0 6 * * *'
workflow_dispatch:
permissions:
@ -10,7 +13,7 @@ jobs:
clear-cache:
runs-on: ubuntu-latest
steps:
- name: Clear cache
- name: Clear Firefox cache
uses: actions/github-script@v7
with:
script: |
@ -20,12 +23,13 @@ jobs:
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
if (cache.key.toLowerCase().startsWith('firefox')) {
console.log(cache)
# Dry run
# github.rest.actions.deleteActionsCacheById({
# owner: context.repo.owner,
# repo: context.repo.repo,
# cache_id: cache.id,
# })
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
}
console.log("Clear completed")