commit-message-validator: stage: validate-commit-message script: - echo "$CI_COMMIT_MESSAGE" - echo "$CI_COMMIT_BRANCH" - echo "check the Prefix of the commit message should have one of 'fix' || 'feat' || 'major' || 'minor' in case sensitive" - exit 1
rules: - if: $CI_COMMIT_MESSAGE =~ /fix: / when: never - if: $CI_COMMIT_MESSAGE =~ /feat: / when: never - if: $CI_COMMIT_MESSAGE =~ /major: / when: never - if: $CI_COMMIT_MESSAGE =~ /minor: / when: never - if: "$CI_COMMIT_MESSAGE =~ /^chore\(release\):.*/" when: never - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH when: never - when: always
The last step in your script
block is exit 1
. Gitlab CI will fail any job that has an exit code > 0.
The commit-message-validator
job doesn't currently do any checks, it simply calls echo
3 times. If you want it to check for fix, feat, major, minor
you will need to do write some logic in the script
block to do so.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.