docs icon indicating copy to clipboard operation
docs copied to clipboard

bug(actions-cache-docs): Example workflow to delete all caches on PR closure does not delete all caches on PRs with many caches

Open erezrokah opened this issue 2 years ago • 2 comments

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries

Specifically image

What part(s) of the article would you like to see updated?

gh actions-cache list returns up to a limit of 30 caches by default, and one can pass -L 100 to have a limit of 100, so stating the workflow deletes all caches can be incorrect for PRs with many caches.

Additional information

  • Feature request to add pagination to gh actions-cache list https://github.com/actions/gh-actions-cache/issues/75
  • gh actions-cache list docs https://github.com/actions/gh-actions-cache#list
  • Workaround is to use gh api, e.g. cacheKeysForPR=$(gh api /repos/$REPO/actions/caches?ref=$BRANCH --paginate | jq -r '.actions_caches[].key' )

erezrokah avatar Jun 26 '23 15:06 erezrokah

Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

welcome[bot] avatar Jun 26 '23 15:06 welcome[bot]

@erezrokah Thank you for opening an issue and linking it to your PR! ✨

cmwilson21 avatar Jun 27 '23 20:06 cmwilson21