Instead of using a boolean and trying to match up a tag that matches our version, I'd bake the branch/tag/ref we wanted to checkout into the URI. That would require us to come up with a sensible format and then process the URI to split it into the repo URI and the ref id that we want to check out.

Something like maybe: user@server:project.git?ref=some_ref_name (basically use a query param at the end)?