ci: fix cleaning caches (#20167)

This commit is contained in:
Jirka Borovec 2024-08-06 12:59:55 +02:00 committed by GitHub
parent b3ee85d3a3
commit 87ffd8ce7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 7 deletions

View File

@ -1,6 +1,9 @@
name: Clear cache weekly name: Clear cache weekly
on: on:
pull_request:
paths:
- ".github/workflows/call-clear-cache.yml"
workflow_dispatch: workflow_dispatch:
inputs: inputs:
pattern: pattern:
@ -8,16 +11,30 @@ on:
default: "pip-|conda" default: "pip-|conda"
required: false required: false
type: string type: string
age-days:
description: "setting the age of caches in days to be dropped"
required: true
type: number
default: 5
schedule:
# on Sundays
- cron: "0 0 * * 0"
jobs: jobs:
cron-clear: cron-clear:
if: github.event_name == 'schedule' if: github.event_name == 'schedule' || github.event_name == 'pull_request'
uses: Lightning-AI/utilities/.github/workflows/clear-cache.yml@v0.11.6 uses: Lightning-AI/utilities/.github/workflows/cleanup-caches.yml@v0.11.6
with: with:
scripts-ref: v0.11.6
dry-run: ${{ github.event_name == 'pull_request' }}
pattern: "latest|docs" pattern: "latest|docs"
age-days: 7
direct-clear: direct-clear:
if: github.event_name == 'workflow_dispatch' if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
uses: Lightning-AI/utilities/.github/workflows/clear-cache.yml@v0.11.6 uses: Lightning-AI/utilities/.github/workflows/cleanup-caches.yml@v0.11.6
with: with:
pattern: ${{ inputs.pattern }} scripts-ref: v0.11.6
dry-run: ${{ github.event_name == 'pull_request' }}
pattern: ${{ inputs.pattern || 'pypi_wheels' }} # setting str in case of PR / debugging
age-days: ${{ inputs.age-days || 0 }} # setting 0 in case of PR / debugging

View File

@ -1,11 +1,11 @@
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries name: cleanup caches on a branch
name: cleanup caches by a branch
on: on:
pull_request: pull_request:
types: [closed] types: [closed]
jobs: jobs:
pr-cleanup: pr-cleanup:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out code - name: Check out code