Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    Thanks, it works. However, if I understand correctly, this workflow must be in the main branch to be visible in the "Actions" tab to be run the first time. Commented Oct 27, 2022 at 8:26
  • Yes, that's how workflow_dispatch works. Any other trigger can be used as well, but only workflow_dispatch gives ability to trigger manually. For manual cache management there is a native UI available now: docs.github.com/en/actions/using-workflows/… Commented Oct 27, 2022 at 10:37
  • How can I remove caches based on 'created_at' key? Basically, I'm trying to remove the cache if it was created last week. Commented Feb 23, 2023 at 23:59
  • @ÖzerÖzdal Add if in the for loop and filter by cache.created_at. See docs.github.com/en/rest/actions/… for details. But why would you do that? GitHub will automatically remove them after 7 days of being unused: docs.github.com/en/actions/using-workflows/… Commented Mar 10, 2023 at 9:51
  • @lukee yes, I did it by running an if and for loop over cache.created_at. Because I have a package that I generate caches on weekly basis for the following week. So I remove old unused caches from the previous week by running a workflow that runs on daily basis. Commented Mar 11, 2023 at 16:41