I have created a basic global automation to increment a field when an issue transitions to the To Do status. The To Do Cycles field will show how many times it went back to "to do".

It is working fine but we don't want it to increment if it moved to a new project. In other words, the field should increment only if it transitions to the To Do status while staying in the same project.
Please guide me on how to implement this restriction or am I looking at it from the wrong angle?
Thank you very much in advance!