Check if the revision property is valid before using it

The revision property is set to an empty string when the build was
initiated by a trigger. As the initial value of merge_sha is also an
empty string, an arbitrary PR is mistakenly chosen, leading to a
mysterious "test successful" message. We should check if the property is
valid before utilising it.

Fixes #15.