I've been trying to write a Jenkinsfile to do different tasks based on whether it's a PR or a merge in Jenkins 2. I've found the snippet below which will tell me if the build was triggered by a user or via Github. The problem is that if the build was started via a PR or a merge the reason is the same. Is there a better way to get this? Thanks!
def causes = currentBuild.rawBuild.getCauses() for ( cause in causes) { echo "Cause: " + cause.getShortDescription() } -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/84409776-adab-42b8-915e-93631557210b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.