Skip to content

Commit

Permalink
ci: fix cleaning caches (#20167)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Aug 6, 2024
1 parent b3ee85d commit 87ffd8c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/call-clear-cache.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
name: Clear cache weekly

on:
pull_request:
paths:
- ".github/workflows/call-clear-cache.yml"
workflow_dispatch:
inputs:
pattern:
description: "pattern for cleaning cache"
default: "pip-|conda"
required: false
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:
cron-clear:
if: github.event_name == 'schedule'
uses: Lightning-AI/utilities/.github/workflows/clear-cache[email protected]
if: github.event_name == 'schedule' || github.event_name == 'pull_request'
uses: Lightning-AI/utilities/.github/workflows/cleanup-caches[email protected]
with:
scripts-ref: v0.11.6
dry-run: ${{ github.event_name == 'pull_request' }}
pattern: "latest|docs"
age-days: 7

direct-clear:
if: github.event_name == 'workflow_dispatch'
uses: Lightning-AI/utilities/.github/workflows/clear-cache[email protected]
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
uses: Lightning-AI/utilities/.github/workflows/cleanup-caches[email protected]
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
4 changes: 2 additions & 2 deletions .github/workflows/cleanup-caches.yml
Original file line number Diff line number Diff line change
@@ -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 by a branch
name: cleanup caches on a branch
on:
pull_request:
types: [closed]

jobs:
pr-cleanup:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand Down

0 comments on commit 87ffd8c

Please sign in to comment.