CI_COMMIT_MESSAGE regex examples in rules
should not use prefix matching due to trailing new line
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Documentation can be improved by using more general examples, which do not fail to work. See pages regarding workflow:rules
:
- https://docs.gitlab.com/ee/ci/yaml/index.html#workflowrules
- https://docs.gitlab.com/ee/ci/yaml/workflow.html#workflow-rules-examples
Here the default example for using CI_COMMIT_MESSAGE
to much a suffix -draft is:
if: $CI_COMMIT_MESSAGE =~ /-draft$/
Due to the way how git commit -m my-draft
works, it will add a trailing new line to the commit message, which is not obvious. Therefore, for a beginner to rules
the above example will always fail to work. It would be more save to provide an example with a prefix notation, which will not fail to work in any environment:
if: $CI_COMMIT_MESSAGE =~ /^draft/
Edited by 🤖 GitLab Bot 🤖