Move GitHub logic to lib