How to set git branch name for a commit to env vars

git
#1

I have different work flows for tags, PRs and pushes. One requirement for the build script is to get the branch name for the commit even for tag triggers (BITRISE_GIT_BRANCH for tag trigger seems to give the default branch). I am trying to get the branch name using git name-rev --name-only $GIT_CLONE_COMMIT_HASH and it seems to be working. But when I am using pipe( | ) with envman add it doesn’t seem to be working. I guess that is because the value is out put using sterr so an alternate solution that I thought of was to write value to a file using git name-rev --name-only $GIT_CLONE_COMMIT_HASH &> branchname.txt and then use envman to and use --valuefile but even then it doesn’t seem to work.

I am hoping to get some solution to this problem, and would really appreciate any help.

0 Likes

closed #2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

0 Likes