The CI_COMMIT_BRANCH description is wrong (or the behaviour is)
So the documentation says CI_COMMIT_BRANCH is only populated when the commit is to a branch - however it appears that this is populated with master rather than not being populated.
Pretty sure this used to be correct, but behaviour seems to have changed.
https://docs.gitlab.com/ee/ci/variables/predefined_variables.html