gitgitlab-cirunner

find current git branch while running job in pipeline


how can I find out branch name in a job that is running in the pipeline? I tried git branch all i get is
* (detached from <commit number>) master


Solution

  • There is a predefined variable called CI_COMMIT_REF_NAME that contains branch name. for more info here