Move yard check to script

[#50752269]

Placing the yard check in the after_script: section did not cause the
build to fail.