Files
orca/.github/workflows/ci-closed-pr-caches.yml
T
Neil d05080175b perf(ci): stop duplicating shared Linux download caches (#23578)
* perf(ci): pilot pnpm verification record caching on Linux

* test(ci): review pnpm verification record in mobile cache audit

* perf(ci): share Electron downloads and clean closed PR caches

* test(ci): retain cache ordering checks for restore-only consumers

* perf(ci): limit archive sharing rollout to primed Linux hosts
2026-09-28 01:58:46 -07:00

34 lines
1.0 KiB
YAML

name: Clean closed PR caches
on:
pull_request_target:
types: [closed]
permissions:
actions: write
jobs:
clean:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# No checkout: this runs trusted default-branch code, including for fork PRs.
- uses: actions/github-script@v8
with:
script: |
const ref = `refs/pull/${context.payload.pull_request.number}/merge`
const caches = await github.paginate(github.rest.actions.getActionsCacheList, {
...context.repo, ref, per_page: 100
})
for (const cache of caches) {
if (cache.ref !== ref) throw new Error(`Unexpected cache ref: ${cache.ref}`)
try {
await github.rest.actions.deleteActionsCacheById({
...context.repo, cache_id: cache.id
})
} catch (error) {
if (error.status !== 404) throw error
}
}
core.info(`Removed ${caches.length} caches scoped to ${ref}`)