Skip to content

deps(gha)(deps): bump docker/login-action from 4.1.0 to 4.2.0 in /.github/workflows #502

deps(gha)(deps): bump docker/login-action from 4.1.0 to 4.2.0 in /.github/workflows

deps(gha)(deps): bump docker/login-action from 4.1.0 to 4.2.0 in /.github/workflows #502

name: PR cache cleanup
on:
pull_request:
types: [closed]
permissions:
actions: write
contents: read
concurrency:
group: pr-cache-cleanup
cancel-in-progress: false
jobs:
purge:
runs-on: ubuntu-latest
steps:
- name: Delete caches scoped to this PR
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const pr = context.payload.pull_request.number;
const refs = [`refs/pull/${pr}/merge`, `refs/pull/${pr}/head`];
for (const ref of refs) {
const { data } = await github.request(
'GET /repos/{owner}/{repo}/actions/caches',
{ owner, repo, ref, per_page: 100 }
);
if (data.total_count === 0) {
core.info(`No caches for ${ref}`);
continue;
}
for (const cache of data.actions_caches) {
core.info(`Deleting cache id ${cache.id} (key: ${cache.key})`);
await github.request(
'DELETE /repos/{owner}/{repo}/actions/caches/{cache_id}',
{ owner, repo, cache_id: cache.id }
);
}
}