How to read labels in Gitlab CI script

Hi all,

I have a few use cases I would like to be able to support:

  1. If a certain label (“skip_build”) is set, the deployment steps should not be run when I merge an MR to a main branch
  2. If another label (“skip_tests”) is set, I should be able to read it as an env var from within the script and alter the flow within the script accordingly (using normal bash syntax).

Is this possible, and if so, how? I’ve tried experimenting with CI_MERGE_REQUEST_LABELS, but it doesn’t seem to be able to read that as an env var from within the script.

Nobody knows anything about this? I think it’s a pretty common use case in Github’s CI, so I’d be surprised if it’s not possible with Gitlab…