I have a job in CloudBees setup to
Build pull requests to the repository
It works fine but what I really need is to be able to get the pull request number that triggered the build for use in the execute shell commands field. I know for sure CloudBees/Jenkins is aware of it because the very first line it prints in the Console Output is
GitHub pull request #4 to owner/repo
But I haven't been able to find a way to easily get access to that #4. I can't find where the console log is stored and it doesn't appear to be an environment variable either. I tried doing an "env" in the execute shell commands field and it wasn't anywhere in there.
How can I get the pull request number from CloudBees/Jenkins for use in the execute shell commands field?