blob: dc1249c8c6e00317659c680fffddfe4a1ca72257 (
plain)
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
|
# Simple job to clear the cache used by a workflow. This automatically runs when a PR is closed/merged
# to clean up the corresponding PR's cache.
name: "clear workflow cache"
on:
workflow_dispatch:
inputs:
id:
description: "Which id to clear. Type 'main'/'master'/'all' to clean all."
required: false
pull_request:
types:
- closed
schedule:
- cron: "0 11 * * *"
jobs:
clear-cache:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1
- run: |
if [[ -n "${{ github.event.schedule }}" ]]; then
python ./scripts/clear_cache.py keep-master
elif [[ -z "${{ github.event.inputs.id }}" ]]; then
python ./scripts/clear_cache.py ${{ github.event.pull_request.number }}
else
python ./scripts/clear_cache.py ${{ github.event.inputs.id }}
fi
|