From c1d0f9a6a77e7ea17e17f06bb524e2dca31eaf67 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Wed, 19 Mar 2025 16:19:45 -0400 Subject: [PATCH] [ci] Parameterize branch cleanup 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