Skip to content

CI: Added tests on OpenBSD & NetBSD #382

CI: Added tests on OpenBSD & NetBSD

CI: Added tests on OpenBSD & NetBSD #382

Workflow file for this run

name: Cleanup caches by a branch
on:
pull_request:
types:
- closed
workflow_dispatch:
inputs:
pull_request_number:
description: 'Run on pull request number'
required: false
type: string
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH=${{ env.PULL_REQUEST_NUMBER && format('refs/pull/{0}/merge', env.PULL_REQUEST_NUMBER) || github.ref }}
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
while [[ $(gh actions-cache list -R $REPO -B $BRANCH | grep -v 'no Actions caches') ]]
do
gh actions-cache list -R $REPO -B $BRANCH --limit=100 | cut -f 1 | xargs -I{} gh actions-cache delete {} -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || inputs.pull_request_number }}