Using environment variables to differentiate between PR / commit runs



Hello there!

I run a project called Danger, which needs to distinguish between code running in a PR, and code running on a commit. Currently we’re doing quite a bit of work to try and determine it, and I’m finding it to be not reliable yet.

So now that there is the extra feature around “PRs only” (thanks for that by the way!) I was wondering if there is a way to distinguish between the two types of builds from the environment vars?


I’ve created a repo specifically showing an example of the three types of builds I’m seeing: