summaryrefslogtreecommitdiffstats
path: root/.github/workflows/clear-workflow-cache.yml
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2022-12-30 00:56:27 -0500
committerGitHub <noreply@github.com>2022-12-30 00:56:27 -0500
commit21a21b86c0bbfd02ae21e0602a02d1c30cb264fb (patch)
tree60e5eedc45e7bd943958e05e0caca4a10feb0b6d /.github/workflows/clear-workflow-cache.yml
parent32da5f39bb2ee74543bce607249df15885d3cf47 (diff)
ci: clean all workflow caches to script (#936)
Diffstat (limited to '.github/workflows/clear-workflow-cache.yml')
-rw-r--r--.github/workflows/clear-workflow-cache.yml32
1 files changed, 32 insertions, 0 deletions
diff --git a/.github/workflows/clear-workflow-cache.yml b/.github/workflows/clear-workflow-cache.yml
new file mode 100644
index 00000000..b4d1a4c2
--- /dev/null
+++ b/.github/workflows/clear-workflow-cache.yml
@@ -0,0 +1,32 @@
+# 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
+
+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 [[ -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