title: Changes not detected in pull requests on Jenkins pipeline plugin
body: <p>I have Jenkins configured to build on pull requests (PR). Our repository is a multi project repository and I have created a script to detect the changes that were made to source code and only run tests that are relevant to the projects that had changes in them (according to the changed file's path):</p>
  
  <pre><code>def getChangedProjects() {
    Set projects = []
    def changeLogSets = currentBuild.changeSets
    for (int i = 0; i &lt; changeLogSets.size(); i++) {
        def entries = changeLogSets[i].items
        for (int j = 0; j &lt; entries.length; j++) {
            def entry = entries[j]
            def files = new ArrayList(entry.affectedFiles)
            for (int k = 0; k &lt; files.size(); k++) {
              def file = files[k]
              // get the project folder name and
              // add it to changed projects set
              projects.add(file.path.tokenize('/')[1])
            }
        }
    }
    return projects.findAll {it != null}
  }
  </code></pre>
  
  <p>The Groovy function works as expected and detects the folder that has changed.</p>
  
  <p>Problem is that most of the times Jenkins will not show any changes in Jenkins:</p>
  
  <p><a href="https://i.stack.imgur.com/7MbFy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7MbFy.png" alt="Changes are not shown"></a></p>
  
  <p>But the PR did contain changes to files and I can see these changes in Github of course.</p>
  
  <p>Anyone know why Jenkins is not showing the changes ?</p>