From 995410463a0d74e43d91816bcda5f10cff82a14a Mon Sep 17 00:00:00 2001 From: lauren Date: Wed, 19 Mar 2025 16:39:01 -0400 Subject: [PATCH] [ci] Parameterize branch cleanup (#32677) Allow a PR number to be passed as input --- .github/workflows/shared_cleanup_branch_caches.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shared_cleanup_branch_caches.yml b/.github/workflows/shared_cleanup_branch_caches.yml index 4df5d705da..7c6a1d5e3a 100644 --- a/.github/workflows/shared_cleanup_branch_caches.yml +++ b/.github/workflows/shared_cleanup_branch_caches.yml @@ -6,6 +6,10 @@ on: types: - closed workflow_dispatch: + inputs: + pr_number: + required: true + type: string jobs: cleanup: @@ -23,13 +27,13 @@ jobs: ## Setting this to not fail the workflow while deleting cache keys. set +e - echo "Deleting caches..." for cacheKey in $cacheKeysForPR do gh cache delete $cacheKey + echo "Deleting $cacheKey" done echo "Done" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} - BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge + BRANCH: refs/pull/${{ inputs.pr_number || github.event.pull_request.number }}/merge