Skip to content

Commit

Permalink
FEAT: add workflow for cleaning cache after a PR
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Jan 26, 2023
1 parent 9c54a1b commit 54ec164
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/clean-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Clean cache
on:
pull_request:
types:
- closed
workflow_dispatch:

jobs:
cleanup:
env:
REPO: ${{ github.repository }}
BRANCH: ${{ github.ref }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Remove PR caches
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: gh extension install actions/gh-actions-cache
- name: Delete caches of latest PR
run: |
set +e
echo "Deleting caches..."
for CACHE_KEY in $(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1); do
gh actions-cache delete $CACHE_KEY -R $REPO -B $BRANCH --confirm
done
echo "Done"
1 change: 1 addition & 0 deletions src/repoma/.github/workflows/clean-cache.yml
1 change: 1 addition & 0 deletions src/repoma/check_dev_files/github_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def update() -> None:
executor(remove_workflow, "ci-style.yml")
executor(remove_workflow, "ci-tests.yml")
executor(remove_workflow, "linkcheck.yml")
executor(_copy_workflow_file, "clean-cache.yml")
if executor.error_messages:
raise PrecommitError(executor.merge_messages())

Expand Down

0 comments on commit 54ec164

Please sign in to comment.