phases: check secret presence the right way during discovery
There is an official function for this, lets use it.
This will prevent the code to break in the future while we refactor the phase
code.
# So GitLab doesn't think we're using tons of Perl*.t -linguist-detectable