Skip to content

Commit

Permalink
Move checking commit message at the end of verifyChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
serban-nicusor-toptal committed Feb 19, 2022
1 parent ed173a0 commit 561cdb0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/org/stan/Utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ def verifyChanges(String sourceCodePaths) {
git config user.name "Stan Jenkins"
"""

// If last commit message contains [ci skip] the current build will be skipped
checkCiSkip = sh (script: "git log -1 | grep '.*\\[ci skip\\].*'", returnStatus: true)
if (checkCiSkip == 0) {
return true
}

// If last commit message contains [ci run all] we will run all stages no matter of source code changes
checkCiRunAll = sh (script: "git log -1 | grep '.*\\[ci run all\\].*'", returnStatus: true)
if (checkCiRunAll == 0) {
return false
}

def commitHash = ""
def changeTarget = ""
def currentRepository = ""
Expand Down Expand Up @@ -188,6 +176,18 @@ def verifyChanges(String sourceCodePaths) {
sh(script: "git merge --abort || true", returnStdout: true)
sh(script: "git reset --hard ${commitHash}", returnStdout: true)

// If last commit message contains [ci skip] the current build will be skipped
checkCiSkip = sh (script: "git log -1 | grep '.*\\[ci skip\\].*'", returnStatus: true)
if (checkCiSkip == 0) {
return true
}

// If last commit message contains [ci run all] we will run all stages no matter of source code changes
checkCiRunAll = sh (script: "git log -1 | grep '.*\\[ci run all\\].*'", returnStatus: true)
if (checkCiRunAll == 0) {
return false
}

if (differences?.trim()) {
println "There are differences in the source code, CI/CD will run."
return false
Expand Down

0 comments on commit 561cdb0

Please sign in to comment.