chore(deps): update dependency @anolilab/semantic-release-preset to ^10.0.2 #97
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://github.com/actions/cache/blob/main/tips-and-workarounds.md#force-deletion-of-caches-overriding-default-cache-eviction-policy | |
name: "Cleanup caches by a branch" | |
on: # yamllint disable-line rule:truthy | |
pull_request: | |
types: | |
- "closed" | |
workflow_dispatch: # yamllint disable-line rule:empty-values | |
workflow_call: | |
inputs: | |
target-repo: | |
description: "The repo to run this action on. This is to prevent actions from running on forks unless intended." | |
required: true | |
type: "string" | |
jobs: | |
cleanup: | |
if: "github.repository == inputs.target-repo" | |
runs-on: "ubuntu-latest" | |
permissions: | |
# `actions:write` permission is required to delete caches | |
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id | |
actions: "write" | |
contents: "read" | |
steps: | |
- name: "Harden Runner" | |
uses: "step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350" # v2.10.3 | |
with: | |
egress-policy: "audit" | |
- name: "Git checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" # v4.2.2 | |
env: | |
GIT_COMMITTER_NAME: "GitHub Actions Shell" | |
GIT_AUTHOR_NAME: "GitHub Actions Shell" | |
EMAIL: "github-actions[bot]@users.noreply.github.com" | |
- name: "Cleanup" | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" | |
echo "Fetching list of cache key" | |
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | |
## Setting this to not fail the workflow while deleting cache keys. | |
set +e | |
echo "Deleting caches..." | |
for cacheKey in $cacheKeysForPR | |
do | |
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | |
done | |
echo "Done" | |
env: | |
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
REPO: "${{ github.repository }}" | |
BRANCH: "refs/pull/${{ github.event.pull_request.number }}/merge" |