added logic to switch to the appropriate branch

switch to the appropriate branch before generating the JSON results file
and pushing it to github