Use CI_COMMIT_SHA instead of CI_COMMIT_BRANCH to check out the commit that belongs to a CI/CD run
While debugging shiny/shadoc#107 I tried to deploy an older version of the code (to development) than the one that the development
branch was pointing to by rerunning an older CI/CD run. That didn't work as expected: instead of checking out the older commit, the commit to which development
currently points to was checked out. I think this is because I used git switch ${CI_COMMIT_BRANCH}
in the .clone-repo-checkout-branch
in gitlab-ci.yml.
I guess we should use git switch ${CI_COMMIT_SHA}
there. According to the documentation CI_COMMIT_SHA
points to "The commit revision the project is built for.", whereas CI_COMMIT_BRANCH
points to the commit branch name.