Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ajohnstone/060f5bb6691d2f0a7442e79884c7c666 to your computer and use it in GitHub Desktop.
Save ajohnstone/060f5bb6691d2f0a7442e79884c7c666 to your computer and use it in GitHub Desktop.
if ( pullRequest.title.toString() =~ /^([A-Z]+\-[0-9]+|NO_JIRA)/ ) {
echo 'invalid-jira - ' + pullRequest.title
pullRequest.createStatus(status: 'success',
context: 'pull-request-fmt',
description: 'pull request contains valid jira ticket',
targetUrl: "${env.JOB_URL}/testResults")
} else {
echo 'valid-jira - ' + pullRequest.title
pullRequest.createStatus(status: 'failure',
context: 'pull-request-fmt',
description: 'pull request does not contain valid jira ticket e.g. SHP-1234|NO_JIRA',
targetUrl: "${env.JOB_URL}/testResults")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment