From 769aed78919d4566b9ceb8f5b695de1ab7db2a35 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Mon, 12 Feb 2024 18:32:59 +0100 Subject: [PATCH] fix: Make sure we delete the right caches --- .github/workflows/clean-cache-post-merge.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/clean-cache-post-merge.yml b/.github/workflows/clean-cache-post-merge.yml index ad77ebf919..79b2775486 100644 --- a/.github/workflows/clean-cache-post-merge.yml +++ b/.github/workflows/clean-cache-post-merge.yml @@ -6,6 +6,11 @@ on: types: - closed workflow_dispatch: + inputs: + branch: + description: "Branch name" + required: false + default: "" jobs: cleanup: @@ -13,6 +18,17 @@ jobs: permissions: actions: write steps: + - name: Setup Branch Name + id: setup-branch + run: | + if [ "${{ github.event.inputs.branch }}" != "" ]; then + echo "branch=${{ github.event.inputs.branch }}" >> $GITHUB_OUTPUT + elif [ "${{ github.head_ref }}" != "" ]; then + echo "branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + else + echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT + fi + - name: Cleanup run: | gh extension install actions/gh-actions-cache @@ -32,4 +48,4 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} REPO: ${{ github.repository }} - BRANCH: ${{ github.ref_name }} + BRANCH: ${{ steps.setup-branch.outputs.branch }}