cbb56f6a61
* feat: implement git checkout caching to speed up CI workflows
- Create cache-checkout action to save/restore git working directory
- Update prepare job in pr.yml to cache checkout after dangerous-git-checkout
- Update all downstream workflows to restore from cache instead of checkout
- Pass commit-sha to all workflow calls for cache key consistency
This reduces the number of full git checkouts from 20+ per workflow run to just 1,
significantly improving CI performance especially for large repos.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* refactor: use actions/cache/restore directly instead of custom action
Remove sparse-checkout and use actions/cache/restore@v4 directly in all
downstream workflows. This eliminates the need for any git fetch operation
before restoring from cache, making the optimization more effective.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* refactor: use github.event.pull_request.head.sha for cache key
- Remove commit-sha input from all downstream workflows
- Update cache-checkout action to use github.event.pull_request.head.sha directly
- Remove commit-sha output from prepare job
- Remove commit-sha from all workflow calls in pr.yml
- Keep sparse-checkout of .github to access the cache-checkout action
This eliminates the need to pass commit-sha around while still using
a reusable action for the cache restore logic.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: update cache key to include branch name and add cache cleanup
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: use github.head_ref and github.sha for cache key
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: add prefix delete before saving cache to clear previous caches
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* perf: add sparse-checkout to exclude example-apps and mp4 files
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: restore get_sha step and commit-sha output that was accidentally removed
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: add trailing dash to cache key prefix to prevent accidental deletion of other branches' caches
The prefix-based cache deletion was using 'git-checkout-{branch}' which would
accidentally match and delete caches for branches with similar prefixes.
For example, branch 'feature' would delete caches for 'feature-2', 'feature-new', etc.
Adding a trailing '-' ensures exact branch matching:
- 'git-checkout-feature-' matches 'git-checkout-feature-abc123' (intended)
- 'git-checkout-feature-' does NOT match 'git-checkout-feature-2-def456' (correct)
Fixes both the cache-checkout action and the PR close cleanup workflow.
Co-Authored-By: unknown <>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
name: Delete Blacksmith Cache
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
cache_key:
|
|
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:
|
|
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"
|
|
|
|
delete-git-checkout-cache-on-pr-close:
|
|
if: github.event_name == 'pull_request' && github.event.action == 'closed'
|
|
runs-on: blacksmith-2vcpu-ubuntu-2404
|
|
steps:
|
|
- name: Delete git-checkout cache
|
|
uses: useblacksmith/cache-delete@v1
|
|
with:
|
|
key: git-checkout-${{ github.event.pull_request.head.ref }}-
|
|
prefix: "true"
|