From 08efcd8e1c8ceb3141c123be5a07020c038d99bf Mon Sep 17 00:00:00 2001 From: Erez Rokah Date: Mon, 26 Jun 2023 18:22:16 +0300 Subject: [PATCH 1/5] fix: Clarify that the example to list and delete caches on PR closure has a limit --- .../caching-dependencies-to-speed-up-workflows.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md index fb926f5a1f2a..89bdd4655716 100644 --- a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md +++ b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md @@ -322,7 +322,7 @@ Caches have branch scope restrictions in place, which means some caches have lim For example, a repository could have many new pull requests opened, each with their own caches that are restricted to that branch. These caches could take up the majority of the cache storage for that repository. Once a repository has reached its maximum cache storage, the cache eviction policy will create space by deleting the oldest caches in the repository. In order to prevent cache thrashing when this happens, you can set up workflows to delete caches on a faster cadence than the cache eviction policy will. You can use the [`gh-actions-cache`](https://github.com/actions/gh-actions-cache/) CLI extension to delete caches for specific branches. -This example workflow uses `gh-actions-cache` to delete all the caches created by a branch once a pull request is closed. +This example workflow uses `gh-actions-cache` to delete all the caches (up to a limit of 100) created by a branch once a pull request is closed. ```yaml name: cleanup caches by a branch @@ -346,7 +346,7 @@ jobs: BRANCH="refs/pull/{% raw %}${{ github.event.pull_request.number }}{% endraw %}/merge" echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 ) ## Setting this to not fail the workflow while deleting cache keys. set +e @@ -360,6 +360,6 @@ jobs: GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} ``` -Alternatively, you can use the API to programmatically delete caches on your own cadence. For more information, see "[AUTOTITLE](/rest/actions/cache#delete-github-actions-caches-for-a-repository-using-a-cache-key)." +Alternatively, you can use the API to programmatically list or delete all caches on your own cadence. For more information, see "[AUTOTITLE](/rest/actions/cache##about-the-cache-in-github-actions)." {% endif %} From 7ca444ee9b8879fadf113665d9945281b5156d17 Mon Sep 17 00:00:00 2001 From: Erez Rokah Date: Mon, 26 Jun 2023 18:31:19 +0300 Subject: [PATCH 2/5] Update caching-dependencies-to-speed-up-workflows.md --- .../caching-dependencies-to-speed-up-workflows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md index 89bdd4655716..349b3f05b584 100644 --- a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md +++ b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md @@ -322,7 +322,7 @@ Caches have branch scope restrictions in place, which means some caches have lim For example, a repository could have many new pull requests opened, each with their own caches that are restricted to that branch. These caches could take up the majority of the cache storage for that repository. Once a repository has reached its maximum cache storage, the cache eviction policy will create space by deleting the oldest caches in the repository. In order to prevent cache thrashing when this happens, you can set up workflows to delete caches on a faster cadence than the cache eviction policy will. You can use the [`gh-actions-cache`](https://github.com/actions/gh-actions-cache/) CLI extension to delete caches for specific branches. -This example workflow uses `gh-actions-cache` to delete all the caches (up to a limit of 100) created by a branch once a pull request is closed. +This example workflow uses `gh-actions-cache` to delete up to a 100 caches created by a branch once a pull request is closed. ```yaml name: cleanup caches by a branch From aaae38ec1f9c997cb18262cad87ddb22d7f2cd0b Mon Sep 17 00:00:00 2001 From: Erez Rokah Date: Mon, 26 Jun 2023 18:38:23 +0300 Subject: [PATCH 3/5] Update caching-dependencies-to-speed-up-workflows.md --- .../caching-dependencies-to-speed-up-workflows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md index 349b3f05b584..61921d470b19 100644 --- a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md +++ b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md @@ -360,6 +360,6 @@ jobs: GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} ``` -Alternatively, you can use the API to programmatically list or delete all caches on your own cadence. For more information, see "[AUTOTITLE](/rest/actions/cache##about-the-cache-in-github-actions)." +Alternatively, you can use the API to programmatically list or delete all caches on your own cadence. For more information, see "[AUTOTITLE](/rest/actions/cache#about-the-cache-in-github-actions)." {% endif %} From aac6e5c23dfbf2a5987da26dfd92a4df2a8f7d8f Mon Sep 17 00:00:00 2001 From: Erez Rokah Date: Wed, 12 Jul 2023 18:34:08 +0300 Subject: [PATCH 4/5] Update content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md Co-authored-by: Christine Belzie <105683440+CBID2@users.noreply.github.com> --- .../caching-dependencies-to-speed-up-workflows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md index 61921d470b19..11b7a0c2569c 100644 --- a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md +++ b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md @@ -360,6 +360,6 @@ jobs: GH_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} ``` -Alternatively, you can use the API to programmatically list or delete all caches on your own cadence. For more information, see "[AUTOTITLE](/rest/actions/cache#about-the-cache-in-github-actions)." +Alternatively, you can use the API to automatically list or delete all caches on your own cadence. For more information, see "[AUTOTITLE](/rest/actions/cache#about-the-cache-in-github-actions)." {% endif %} From 03d6f80b4f87c16e127e62d5aeead36b53d4f772 Mon Sep 17 00:00:00 2001 From: Siara <108543037+SiaraMist@users.noreply.github.com> Date: Fri, 14 Jul 2023 14:38:02 -0700 Subject: [PATCH 5/5] Update content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md --- .../caching-dependencies-to-speed-up-workflows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md index 11b7a0c2569c..c511af091693 100644 --- a/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md +++ b/content/actions/using-workflows/caching-dependencies-to-speed-up-workflows.md @@ -322,7 +322,7 @@ Caches have branch scope restrictions in place, which means some caches have lim For example, a repository could have many new pull requests opened, each with their own caches that are restricted to that branch. These caches could take up the majority of the cache storage for that repository. Once a repository has reached its maximum cache storage, the cache eviction policy will create space by deleting the oldest caches in the repository. In order to prevent cache thrashing when this happens, you can set up workflows to delete caches on a faster cadence than the cache eviction policy will. You can use the [`gh-actions-cache`](https://github.com/actions/gh-actions-cache/) CLI extension to delete caches for specific branches. -This example workflow uses `gh-actions-cache` to delete up to a 100 caches created by a branch once a pull request is closed. +This example workflow uses `gh-actions-cache` to delete up to 100 caches created by a branch once a pull request is closed. ```yaml name: cleanup caches by a branch