Wechsel in Jenkins Pipeline

stage ("Deploy branches") {
    agent any

    when { 
        allOf {
            not { branch 'master' }
            changeset "some-directory/**"
            expression {  // there are changes in some-directory/...
                sh(returnStatus: true, script: 'git diff  origin/master --name-only | grep --quiet "^some-directory/.*"') == 0
            }
            expression {   // ...and nowhere else.
                sh(returnStatus: true, script: 'git diff origin/master --name-only | grep --quiet --invert-match "^some-directory/.*"') == 1
            }
        }
    }

    steps {
        // do stuff
    }
}
Inquisitive Ibis