mirror of
https://github.com/storytold/egui.git
synced 2026-11-18 05:59:58 +00:00
20a77df346
Adds step-security/harden-runner (audit, pinned to v2.22.4 like craft-common-actions) as the first step of each job that did not have it, so every workflow in the org's public repos reports its egress to StepSecurity. Audit, not block: block-mode allow lists come from each job's observed traffic.
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
# Delete the GitHub Actions caches of a pull request once it is closed.
|
|
#
|
|
# A repository can only hold 10 GB of caches, and the oldest ones are evicted when it is full.
|
|
# Without this the caches of merged pull requests would push out the `main` cache
|
|
# that every new pull request starts from.
|
|
|
|
name: Cache Cleanup
|
|
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
|
|
permissions:
|
|
actions: write
|
|
|
|
jobs:
|
|
cleanup:
|
|
name: Delete the caches of the closed PR
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Harden runner
|
|
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
|
|
with:
|
|
egress-policy: audit
|
|
- name: Delete caches
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
PR_REF: refs/pull/${{ github.event.pull_request.number }}/merge
|
|
BRANCH_REF: refs/heads/${{ github.event.pull_request.head.ref }}
|
|
run: |
|
|
for ref in "$PR_REF" "$BRANCH_REF"; do
|
|
echo "Deleting the caches of $ref"
|
|
gh cache list --ref "$ref" --limit 100 --json id --jq '.[].id' \
|
|
| xargs -r -I {} gh cache delete {}
|
|
done
|