CI: Cleanup and enhance to specify platform branch
Fix indentation; setup some more clear variables.
Add a third variable to ensure the proper platform branch is checked out. This is necessary because otherwise environment deploys get stuck because the platform directory is in a detached state and then the environment deploys will not proceed because the branch check fails. This will fix #8843 (closed).