Fix ensure_branches with more than one branch
Only the first item was processed due to calling return
immediately instead
of collecting all the actions and only returning at the end.
Only the first item was processed due to calling return
immediately instead
of collecting all the actions and only returning at the end.