Files
calendar/.github/actions/cache-build-key/action.yml
T
Keith WilliamsGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
7985732683 chore: Delete cache-build cache entries on PR close (#26312)
* chore: Delete cache-build cache entries on PR close

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* 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: keith@cal.com <keithwillcode@gmail.com>

* fix: Remove PR head SHA checkout per review feedback

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

* 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: keith@cal.com <keithwillcode@gmail.com>

* refactor: Simplify cache key by removing Linux and node version segments

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-12-30 11:24:33 -03:00

24 lines
1.0 KiB
YAML

name: Generate cache-build key
description: "Generate the cache key for production build caching"
inputs:
branch_key:
required: true
description: "Branch key for cache scoping (e.g., github.head_ref for PRs)"
outputs:
key:
description: "The generated cache key"
value: ${{ steps.generate-key.outputs.key }}
runs:
using: "composite"
steps:
- name: Generate cache key
id: generate-key
shell: bash
env:
CACHE_NAME: prod-build
BRANCH_KEY: ${{ inputs.branch_key }}
LOCKFILE_HASH: ${{ hashFiles('yarn.lock') }}
SOURCE_HASH: ${{ hashFiles('apps/**/**.[jt]s', 'apps/**/**.[jt]sx', 'apps/**/*.json', 'apps/**/*.css', 'packages/**/**.[jt]s', 'packages/**/**.[jt]sx', 'packages/prisma/schema.prisma', 'packages/prisma/migrations/**/*.sql', '!**/node_modules/**', '!packages/prisma/generated/**', '!packages/prisma/client/**', '!packages/prisma/zod/**', '!packages/kysely/**') }}
run: |
echo "key=${CACHE_NAME}-${BRANCH_KEY}-${LOCKFILE_HASH}-${SOURCE_HASH}" >> $GITHUB_OUTPUT