Differentiate "build" and "rebuild"

How can we differentiate “build” and “rebuild”?
For example:
if build then statement1;
if rebuild then statement2;

Any ideas? Thanks.

1 Like

I’m not sure the best way to do something like this. This feature request is asking for an environment variable for rebuilds. If/when that gets done, then this would be much easier. You can show your support for that feature request by clicking ‘like’ on the original post.

For now, utilizing the CircleCI API to check if the current build’s hash has already been built might be a way to do this but a fair amount of work.

1 Like

Thanks for your response. Gonna try it via API.