Skip to content

Commit

Permalink
Clear cache workflow (#2703)
Browse files Browse the repository at this point in the history
<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2703) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2703)
- [Docs preview](https://rerun.io/preview/pr%3Ajan%2Fclear-cache/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Ajan%2Fclear-cache/examples)
  • Loading branch information
jprochazk authored Jul 17, 2023
1 parent 227b49c commit d5c3826
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/clear_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Clear cache

on:
workflow_dispatch:

permissions:
actions: write

jobs:
clear-cache:
runs-on: ubuntu-latest
steps:
- name: Clear cache
uses: actions/github-script@v6
with:
script: |
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
});
console.log(`clearing ${caches.total_count} cache entries`);
for (const cache of caches.data.actions_caches) {
console.log(`clearing ${cache.key}`);
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
}).then(() => console.log(`cleared ${cache.key}`));
}

0 comments on commit d5c3826

Please sign in to comment.