Add check for ref being a string before applying regex
Add check for ref being a string before applying regex

Incorrect filter by ref in zuul layout could end on
applying a regex to a None value, causing an error and
zuul crashing. That is not an usual thing but could happen
and zuul crashes because of that.

Add the comparison for ref not being None
before applying the regex, as it was done for comment
comparison.

Change-Id: Ie58bb288a1f7609564283a0062e08ecc45b28cd0

gooddata/zuul,gooddata/zuul,wikimedia/integration-zuul,wikimedia/integration-zuul,gooddata/zuul,gooddata/zuul,wikimedia/integration-zuul,wikimedia/integration-zuul,gooddata/zuul