diff options
author | Chris Rebert <code@rebertia.com> | 2014-11-21 05:59:50 +0300 |
---|---|---|
committer | Chris Rebert <code@rebertia.com> | 2014-11-21 06:03:24 +0300 |
commit | e4d8a307811a99e8fdaae3300b5192a6d2f1aa7c (patch) | |
tree | 0740f4b7c8198d44004d404a9503bf88d7ba1678 /src | |
parent | 43c35becd1ca446a29ef1e396615b02ea8fc0cf8 (diff) |
Add setting to ignore PRs whose branches are from the main repo; closes #2
Diffstat (limited to 'src')
3 files changed, 3 insertions, 0 deletions
diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index 19ef0bc..03bfcdc 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -23,6 +23,7 @@ savage { default-port = 6060 github-repo-to-watch = "twbs/bootstrap" github-test-repo = "twbs-savage/bootstrap" + ignore-branches-from-watched-repo = true whitelist = [ "**.md", "/bower.json", diff --git a/src/main/scala/com/getbootstrap/savage/server/PullRequestEventHandler.scala b/src/main/scala/com/getbootstrap/savage/server/PullRequestEventHandler.scala index da3d464..244b5d4 100644 --- a/src/main/scala/com/getbootstrap/savage/server/PullRequestEventHandler.scala +++ b/src/main/scala/com/getbootstrap/savage/server/PullRequestEventHandler.scala @@ -57,6 +57,7 @@ class PullRequestEventHandler(protected val pusher: ActorRef) extends GitHubActo case "master" => { prHead.getRepo.repositoryId match { case None => log.error(s"Received event from GitHub about repository with unsafe name") + case Some(settings.MainRepoId) if settings.IgnoreBranchesFromMainRepo => log.info("Ignoring PR whose branch is from the main repo, per settings.") case Some(foreignRepo) => { val baseSha = bsBase.commitSha val headSha = prHead.commitSha diff --git a/src/main/scala/com/getbootstrap/savage/server/Settings.scala b/src/main/scala/com/getbootstrap/savage/server/Settings.scala index 9ae2cfd..c6989d4 100644 --- a/src/main/scala/com/getbootstrap/savage/server/Settings.scala +++ b/src/main/scala/com/getbootstrap/savage/server/Settings.scala @@ -22,6 +22,7 @@ class SettingsImpl(config: Config) extends Extension { val Whitelist: FilePathWhitelist = new FilePathWhitelist(config.getStringList("savage.whitelist").asScala) val Watchlist: FilePathWatchlist = new FilePathWatchlist(config.getStringList("savage.file-watchlist").asScala) val BranchPrefix: String = config.getString("savage.branch-prefix") + val IgnoreBranchesFromMainRepo: Boolean = config.getBoolean("savage.ignore-branches-from-watched-repo") } object Settings extends ExtensionId[SettingsImpl] with ExtensionIdProvider { override def lookup() = Settings |