Checked out branch on GitLab CI is un-intuitive

Steps to reproduce

  1. Create a new GitLab project
  2. Perform a git based operation on branch using $CI_COMMIT_BRANCH. We get an error like this:

Screenshot_2023-01-24_at_11.33.10_AM

-- https://gitlab.com/tkuah/change_files/-/jobs/3647921580

Observations:

  1. Seeing Checking out acbaaf42 as main..., I expect the branch to be main but as you can see in above screenshot, it is detached. Is this expected ?
  2. If this detached is expected, can we improve the above message ?
  3. Could we also document this somewhere in https://docs.gitlab.com/ee/ci/pipelines/ ?

Note: I am unsure if this is a typebug but will start with bug for now