Skip to content

CI: add workflow to cleanup PR caches on close #5128

@RishavTiwari25

Description

@RishavTiwari25

I think we should improve the way we manage our GitHub Actions cache limits by adding an automated workflow that deletes runner caches scoped to a pull request when it is closed or merged.

Currently, our CI uses GitHub Actions caching extensively (saving cargo registries, index, and build artifacts) to speed up our tests. However, we do not have an automated way to clean up orphaned caches once a PR is closed or merged. Without cleanup, these orphaned caches can accumulate and quickly consume the repository's 10 GB cache storage limit, causing cache eviction churn and slowing down active PRs.

We could implement this by adding a small .github/workflows/cleanup-caches.yml workflow that triggers on pull_request: [closed] and uses the gh actions-cache delete CLI extension or a community action to clear up space when it's no longer needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions