How to check if a pipeline is triggered from a pull request
<p>I'm using Jenkins pipeline to build Pull Requests branches using the GitHub Organization plugin.</p>

<p>I can build them fine, but I want to avoid some steps (such as publishing the artifacts). Checking git's current branch gives me the PR's target since the PR branch is being merged into the target before the build is attempted.</p>

<p>How can I check if the build is being initiated from a PR vs than a regular branch build?</p>