Skip to content

Add gh cache command or extension for Actions  #7014

Description

@sschuberth

Describe the feature or problem you’d like to solve

I'm trying to get rid of bogus CI failures caused by action caches that erroneously were not evicted.

Proposed solution

Please add a command that allows build-deletion of all caches for a repository. The UI currently only allows to delete caches one-by-one, which is cumbersome if there are many of them.

Additional context

https://docs.github.com/en/rest/actions/cache

Activity

  1. vilmibm commented on Feb 16, 2023

    @vilmibm
    Contributor

    in general we avoid bulk operation commands in favor of commands that can be scripted to perform bulk tasks.

    does gh currently give you the tools you need to enumerate a repository's caches so bulk deletion can be scripted?

  2. added
    more-info-neededMore info needed from user/contributor
    and removed on Feb 16, 2023
  3. sschuberth commented on Feb 17, 2023

    @sschuberth
    Author

    does gh currently give you the tools you need to enumerate a repository's caches so bulk deletion can be scripted?

    I don't know. But given that gh api graphql can execute arbitrary queries, I'd guess there's a syntax that can accomplish what I want. But avoiding to learn qraphql to find out the proper query was the point for asking for this convenience command.

  4. changed the title [-]Add a command to bulk-delete all caches of a repository[/-] [+]Add `gh cache` command for Actions [/+] on Feb 17, 2023
  5. vilmibm commented on Feb 17, 2023

    @vilmibm
    Contributor

    sure, that's what I was getting at. It sounds like we can turn this issue into a feature request for a new gh cache command to go alongside of gh run and gh workflow.

    I'm imagining something like:

    gh cache list -R <repo>
    gh cache delete -R <repo> <integer ID or string key>
    gh cache delete -R <repo> --all
    

    (with -R being optional if cwd is a local repository clone)

    I think a --all is ok here even though we don't typically do bulk operations since "blast all caches for a repo" seems like a common use case.

    The bad news is that we are stretched thin and it'll be some time before it's even an option for us to prioritize this on the core team, so I'm marking this as help wanted / extension idea. I'm happy to talk more about UX if someone wants to pick it up.

    In the short term @sschuberth I'd recommend learning how to do this with gh api; I'm sorry for the unsatisfactory answer, there.

  6. added
    extension-ideaAn idea that could make a good GitHub CLI extension
    and removed
    more-info-neededMore info needed from user/contributor
    on Feb 17, 2023
  7. changed the title [-]Add `gh cache` command for Actions [/-] [+]Add `gh cache` command or extension for Actions [/+] on Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsenhancementa request to improve CLIextension-ideaAn idea that could make a good GitHub CLI extensionhelp wantedContributions welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions