extract repo setup into a function