From 5a9d7f3e99a63b0416d373dc304c66afcf76c424 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Mon, 7 Oct 2024 15:53:20 -0700 Subject: [PATCH] Using event.release.target_commitish for target branch Can use this. Or can set it to use the default branch always since the releases would only be triggered on changes to master branch. --- .github/workflows/image_build_push.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/image_build_push.yml b/.github/workflows/image_build_push.yml index 6398ad302..cdc4a5970 100644 --- a/.github/workflows/image_build_push.yml +++ b/.github/workflows/image_build_push.yml @@ -74,9 +74,11 @@ jobs: id: get-branch-name run: | if [ "${{ github.ref_type }}" == "tag" ]; then - base_ref=${{ github.event.base_ref }} - echo "Branch name: branch_name=${base_ref#refs/heads/}" - echo "branch_name=${base_ref#refs/heads/}" >> "$GITHUB_OUTPUT" + # base_ref=${{ github.event.base_ref }} + # echo "Branch name: branch_name=${base_ref#refs/heads/}" + # echo "branch_name=${base_ref#refs/heads/}" >> "$GITHUB_OUTPUT" + target_branch=${{ github.event.release.target_commitish }} + echo "branch_name=${target_branch}" >> "$GITHUB_OUTPUT" elif [ "${{ github.ref_type }}" == "branch" ]; then echo "branch_name=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT" fi