title: Get Branch name in gitlab ci
body: <p>In my Gitlab CI, I have a stage that triggers another stage by api call trigger and  I want to pass the current branch name as parameter to the other project holding the trigger. I used the <code>CI_COMMIT_REF_NAME</code> for this, it seemed to work, but now that I call the stage only when merging the branch to master, the <code>CI_COMMIT_REF_NAME</code> always says &quot;master&quot;.</p>
  <p>In the <a href="https://docs.gitlab.com/ee/ci/variables/#variables" rel="noreferrer">documentation</a> it says &quot;The branch or tag name for which project is built&quot;, do I understand it correctly that it kind of holds the target branch of my working branch?</p>
  <p>I tried to get the current branch in gitlab ci with <code>git symbolic-ref HEAD | sed 's!refs\/heads\/!!'</code> as well but it was empty.</p>
  <p>Is <code>CI_COMMIT_REF_NAME</code> the variable I am looking for and something is going wrong or do I need something else?</p>
  <p>Thanks in advance.</p>