-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.09 KB
/
prune-actions-caches.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Prune GitHub Actions Caches
on:
schedule:
- cron: '0 0 * * *'
pull_request:
types:
- closed
workflow_dispatch:
inputs:
date_interval:
description: How old should be flushed?
required: true
default: 'P2D'
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
REPO: ${{ github.repository }}
jobs:
prune:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run prune-cache on pull requests
if: github.event_name == 'pull_request'
run: |
bin/prune-cache ${{ env.REPO }} --pr-branch ${{ env.PR_BRANCH }}
env:
PR_BRANCH: ${{ github.event.pull_request.number }}
- name: Run prune-cache on schedule
if: github.event_name == 'schedule'
run: |
bin/prune-cache ${{ env.REPO }} --schedule
- name: Run prune-cache on workflow dispatch
if: github.event_name == 'workflow_dispatch'
run: |
bin/prune-cache ${{ env.REPO }} --schedule
env:
DATE_INTERVAL: ${{ inputs.date_interval || 'P2D' }}