gitlabgitlab-ciregex-negationrulesvalidationrules

How did we combine a sequence to commit branches in GitLab?


I'm facing syntax issue

($CI_COMMIT_BRANCH =~ /^[A-Z][0-9][-_]SPRINT[0-9]+/i)
($CI_COMMIT_BRANCH =~ /^SPRINT[0-9]+/i)
($CI_COMMIT_BRANCH =~ /^[A-Z]SPRINT[0-9]+/i)]

(SPRINT-branch name) can you please help me to combine these split sequence into single command line


Solution

  • You can use:

    ^([A-Z]([0-9][-_])?)?SPRINT[0-9]+
    

    The code can look like

    ($CI_COMMIT_BRANCH !~ (/^([A-Z]([0-9][-_])?)?SPRINT[0-9]+/i))
    

    See the matches in this regex 101 demo.