9194ef5abd
Docs/Test Workflow / Test docs build (push) Failing after 0s
Check links & references / links-check (push) Failing after 1s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.10) (push) Failing after 0s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.11) (push) Failing after 0s
PR Conflict Labeler / main (push) Failing after 2s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.12) (push) Failing after 2s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.13) (push) Failing after 0s
Pytest/Test Workflow / Build this Package (push) Failing after 5s
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.10) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.11) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.12) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.13) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.10) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.11) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.12) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.13) (push) Has been cancelled
Pytest/Test Workflow / testing-guardian (push) Has been cancelled
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
name: Clear cache
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 0 1 * *" # Run at midnight on the first day of every month
|
|
workflow_dispatch:
|
|
|
|
# Restrict permissions by default
|
|
permissions:
|
|
actions: write # Required for cache management
|
|
|
|
jobs:
|
|
clear-cache:
|
|
name: Clear cache
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Clear cache
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
with:
|
|
script: |
|
|
console.log("Starting cache cleanup...")
|
|
const caches = await github.rest.actions.getActionsCacheList({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
})
|
|
|
|
let deletedCount = 0
|
|
for (const cache of caches.data.actions_caches) {
|
|
console.log(`Deleting cache: ${cache.key} (${cache.size_in_bytes} bytes)`)
|
|
try {
|
|
await github.rest.actions.deleteActionsCacheById({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
cache_id: cache.id,
|
|
})
|
|
deletedCount++
|
|
} catch (error) {
|
|
console.error(`Failed to delete cache ${cache.key}: ${error.message}`)
|
|
}
|
|
}
|
|
console.log(`Cache cleanup completed. Deleted ${deletedCount} caches.`)
|