chore: Delete cache-build cache entries on PR close (#26312)
* chore: Delete cache-build cache entries on PR close Co-Authored-By: [email protected] <[email protected]> * refactor: Extract cache-build key generation into reusable action - Create .github/actions/cache-build-key to generate cache keys - Update cache-build action to use the shared key action - Update delete workflow to use the shared key action - Checkout PR head SHA in delete workflow for correct hash computation Co-Authored-By: [email protected] <[email protected]> * fix: Remove PR head SHA checkout per review feedback Co-Authored-By: [email protected] <[email protected]> * refactor: Use prefix-based cache deletion for simpler cleanup - Use useblacksmith/cache-delete prefix mode to delete all caches matching branch - Remove dependency on cache-build-key action for deletion - No checkout needed since we're just using the branch name as prefix Co-Authored-By: [email protected] <[email protected]> * refactor: Simplify cache key by removing Linux and node version segments Co-Authored-By: [email protected] <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
2b61bddf7b
commit
7985732683
3 files changed
+47
-16
No files matched your search
@@ -1,4 +1,4 @@
|
||||
name: Manually Delete Blacksmith Cache
|
||||
name: Delete Blacksmith Cache
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -6,12 +6,28 @@ on:
|
||||
description: "Blacksmith Cache Key to Delete"
|
||||
required: true
|
||||
type: string
|
||||
pull_request:
|
||||
types: [closed]
|
||||
|
||||
jobs:
|
||||
manually-delete-blacksmith-cache:
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
runs-on: blacksmith-2vcpu-ubuntu-2404
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- uses: useblacksmith/cache-delete@v1
|
||||
with:
|
||||
cache_key: ${{ inputs.cache_key }}
|
||||
key: ${{ inputs.cache_key }}
|
||||
|
||||
delete-cache-build-on-pr-close:
|
||||
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
||||
runs-on: blacksmith-2vcpu-ubuntu-2404
|
||||
env:
|
||||
CACHE_NAME: prod-build
|
||||
steps:
|
||||
- name: Delete cache-build cache
|
||||
uses: useblacksmith/cache-delete@v1
|
||||
with:
|
||||
key: ${{ env.CACHE_NAME }}-${{ github.event.pull_request.head.ref }}
|
||||
prefix: "true"
|
||||
Reference in new issue
Block a user