Detecting whether a build was triggered by pushing "Rebuild" button


I’m trying to figure out how to do the following in a deploy script on master:

if (codeInAppDirChanged || rebuildTriggered) {

I think I can get the first condition by doing something with git, but is there any way to detect whether a build is a rebuild? The idea is that 99% of the time this will just do the right thing, but in case I need to force a new beta release, I can just push the “Rebuild” button on master in CircleCI. Is there an env var I can interrogate or something?