title: Jenkins pipeline determine if a branch is for Bitbucket pull request
body: <p>I'm using Jenkins together with the <a href="https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/docs/USER_GUIDE.adoc" rel="noreferrer">Bitbucket branch source plugin</a>. </p>
  
  <p>Everything works great, but I want to be able to run/exclude certain stages in my pipeline depending on whether the branch is associated with a pull request or not, such as:</p>
  
  <pre><code>pipeline {
    stages {
      stage('build') {
        //compile
      }    
      stage('package') {
        when {
          environment name: 'IS_PULL_REQUEST', value: 'true'
        }      
        //create deployable package
      }
    }
  }
  </code></pre>
  
  <p>Jenkins knows when the branch is for a PR because it merges the source with the target and also displays the branch in the pull request folder on the multibranch pipeline page.</p>
  
  <p>Is there an environment variable I can use within the pipeline to exclude/include stages?</p>