-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
34 lines (31 loc) · 958 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
pipeline {
agent any
stages {
stage('Checkout Code') {
steps {
checkout scm
}
}
stage('Validate Commit Messages') {
steps {
script {
def latestCommitMessage = sh(script: 'git log -1 --pretty=%B', returnStdout: true).trim()
if (!(latestCommitMessage =~ /^(fix|feat|chore|docs|style|refactor|test|perf|build|ci|revert|version|merge|hotfix|wip)\:.*/)) {
error "The commit message does not follow the Conventional Commit format:\n${latestCommitMessage}"
}
}
}
}
}
post {
always {
cleanWs()
}
success {
echo 'Commit message follows Conventional Commit format'
}
failure {
error 'Commit message does not follow Conventional Commit format'
}
}
}