From a266bc2407fe97ef3014e576258ec83d5246ffbb Mon Sep 17 00:00:00 2001 From: lindseydew Date: Tue, 8 Apr 2014 16:07:53 +0100 Subject: [PATCH] Check if the all team exists, and if not create one --- app/lib/Implicits.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/lib/Implicits.scala b/app/lib/Implicits.scala index f5d5816..058d8c0 100644 --- a/app/lib/Implicits.scala +++ b/app/lib/Implicits.scala @@ -6,6 +6,7 @@ import scala.util.{Success, Try} import com.github.nscala_time.time.Imports._ import scala.concurrent._ import ExecutionContext.Implicits.global +import org.kohsuke.github.GHOrganization.Permission object Implicits { implicit class RichFuture[S](f: Future[S]) { @@ -31,7 +32,7 @@ object Implicits { lazy val allTeamOpt = teamsByName.get("all") - lazy val allTeam = allTeamOpt.getOrElse(throw new IllegalStateException("Missing 'all' team - GU-Who needs the 'all' team to operate")) + lazy val allTeam = allTeamOpt.getOrElse(createAllTeam) lazy val botsTeamOpt = teamsByName.get("bots") @@ -42,6 +43,12 @@ object Implicits { orgMember } } + + def createAllTeam: GHTeam = { + val team = org.createTeam("all", Permission.PULL) + team.add(peopleRepo) + team + } } implicit class RichTeam(team: GHTeam) {