Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/savage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/main/resources/application.conf1
-rw-r--r--src/main/scala/com/getbootstrap/savage/server/PullRequestEventHandler.scala1
-rw-r--r--src/main/scala/com/getbootstrap/savage/server/Settings.scala1
4 files changed, 5 insertions, 0 deletions
diff --git a/README.md b/README.md
index 75b40b6..49453ef 100644
--- a/README.md
+++ b/README.md
@@ -62,6 +62,8 @@ savage {
github-repo-to-watch = "twbs/bootstrap"
// Full name of GitHub repo to push test branches to
github-test-repo = "twbs/bootstrap-tests"
+ // Ignore pull requests whose branch is from the watched repo (and is thus from a project team member)
+ ignore-branches-from-watched-repo = true
// List of Unix file globs constituting the whitelist of safely editable files
whitelist = [
"**.md",
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