Open soondl opened 3 years ago
I don't think REGEX works here. I also want to know how to make this work
I also had the same problem as you. I could not find the right answer, but my solution was the following:
Let all PR trigger a build.
Then, on the pipeline, you simply do the following:
environment {
PULL_TITLE = "${ghprbPullTitle}"
}
stage('Skip Build') {
when {
expression {
return !(env.PULL_TITLE =~ /\b(DEV|QA|STG|PRD|DEVOPS)\b/)
}
}
steps {
script {
echo "PR title does not contain any of the specified words. Skipping the build."
currentBuild.result = 'ABORTED'
error("Aborting the build.")
}
}
}
If the PR title doesn't have the words I want, then skip the build.
It will show up like this:
I want to trigger build only when there is a string "[iOS]" in PR title. For example,
[iOS] Fix view logic
I found the parameter "skip build phrase" and I wrote it as follows to match the phrase that does not contain "iOS", but it didn't work.
Is there any other way? Thank you.