Issue
Hi, I'm a Jenkins noob here, may I ask if there is a way for me to get the build trigger type (manual or auto) of the current build and the update status of the working copy like in the image above (no change or there are commits) in the Groovy script, so Jenkins can skip the auto build if there is no change?
Thanks a lot.
Solution
You can use the following groovy snippet to get the number changes.
if(currentBuild.changeSets.size() > 0) {
// Chnages are present
}
As MB mentioned you can do currentBuild.getBuildCauses('hudson.model.Cause$UserIdCause')
to get manual triggers.
Answered By - ycr
Answer Checked By - Cary Denson (JavaFixing Admin)