File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -791,16 +791,19 @@ jobs:
791791 steps :
792792 - name : Checkout
793793 uses : actions/checkout@v4
794+ with :
795+ fetch-depth : 0
794796 - name : Detect branch name
795797 id : detect_branch
796- env :
797- EVENT_BASE_REF : ${{ github.event.base_ref || 'tag_on_unknown_branch_commit_not_pushed' }}
798798 run : |
799- BRANCH=${EVENT_BASE_REF#refs/heads/}
799+ GIT_BRANCHES=$(git branch -r --contains ${{ github.ref_name }})
800+ echo "Git contains: $GIT_BRANCHES"
801+
802+ BRANCH="$(echo ${GIT_BRANCHES//origin\//} | tr -d '\n')"
800803
801- if [ " $BRANCH" == "tag_on_unknown_branch_commit_not_pushed" ]; then
802- echo "Error: Could not detect branch name. Most likely this is that commit for tag is not pushed yet."
803- exit 1
804+ if [[ -z $BRANCH ] ]; then
805+ echo "Error: Could not detect branch name. Most likely this is that commit for tag is not pushed yet."
806+ exit 1
804807 fi
805808
806809 echo "Detected branch: $BRANCH"
You can’t perform that action at this time.
0 commit comments