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:
authorChris Rebert <github@chrisrebert.com>2016-07-08 11:23:47 +0300
committerGitHub <noreply@github.com>2016-07-08 11:23:47 +0300
commitb122272d680bff5efd4f4b225bd6dfd7b955a4b6 (patch)
tree94f68d10813ba7edd3bc0aded2d940a0449efdcc
parent5f4f917ce80fca357c6342c26d341215ad5901e4 (diff)
Add option to show preview URL for the PR in the GitHub comment (#42)
Refs https://github.com/twbs/bootstrap/pull/20179
-rw-r--r--README.md4
-rw-r--r--src/main/resources/application.conf1
-rw-r--r--src/main/scala/com/getbootstrap/savage/server/PullRequestCommenter.scala2
-rw-r--r--src/main/scala/com/getbootstrap/savage/server/Settings.scala1
4 files changed, 8 insertions, 0 deletions
diff --git a/README.md b/README.md
index 7fd81d4..dfb5181 100644
--- a/README.md
+++ b/README.md
@@ -77,6 +77,10 @@ savage {
// pushing the branch to GitHub, Savage will assume something went wrong and delete the branch to
// keep the test repo's branches tidy.
travis-timeout = 2 hours
+ // Include a link to the "preview URL" of the PR in the GitHub comment?
+ // Probably only makes sense if you're Bootstrap.
+ // Otherwise, you'll need to edit the hardcoded URL template string.
+ show-preview-urls = false
// Full name of GitHub repo to watch for new pull requests
github-repo-to-watch = "twbs/bootstrap"
// Full name of GitHub repo to push test branches to
diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf
index f2782b3..d6b2f1a 100644
--- a/src/main/resources/application.conf
+++ b/src/main/resources/application.conf
@@ -26,6 +26,7 @@ savage {
squelch-invalid-http-logging = true
set-commit-status = true
travis-timeout = 2 hours
+ show-preview-urls = true
github-repo-to-watch = "twbs/bootstrap"
github-test-repo = "twbs-savage/bootstrap"
allowed-base-branches = [ "master", "v4-dev", "v3-dev" ]
diff --git a/src/main/scala/com/getbootstrap/savage/server/PullRequestCommenter.scala b/src/main/scala/com/getbootstrap/savage/server/PullRequestCommenter.scala
index b31e08f..1701d90 100644
--- a/src/main/scala/com/getbootstrap/savage/server/PullRequestCommenter.scala
+++ b/src/main/scala/com/getbootstrap/savage/server/PullRequestCommenter.scala
@@ -15,12 +15,14 @@ class PullRequestCommenter extends GitHubActorWithLogging {
case PullRequestBuildResult(prNum, commitSha, buildUrl, succeeded) => {
val mythicalStatus = if (succeeded) { "**CONFIRMED**" } else { "**BUSTED**" }
val plainStatus = if (succeeded) { "**Tests passed.**" } else { "**Tests failed.**" }
+ val previewInfo = if (settings.ShowPreviewUrls) { "Docs preview: http://preview.twbsapps.com/c/${commitSha.sha}" } else { "" }
val commentMarkdown = s"""
|${plainStatus} Automated cross-browser testing via Sauce Labs and Travis CI shows that the JavaScript changes in this pull request are: ${mythicalStatus}
|
|Commit: ${commitSha.sha}
|Build details: ${buildUrl}
+ |${previewInfo}
|
|(*Please note that this is a [fully automated](https://github.com/twbs/savage) comment.*)
""".stripMargin
diff --git a/src/main/scala/com/getbootstrap/savage/server/Settings.scala b/src/main/scala/com/getbootstrap/savage/server/Settings.scala
index 5a2041a..2a31f49 100644
--- a/src/main/scala/com/getbootstrap/savage/server/Settings.scala
+++ b/src/main/scala/com/getbootstrap/savage/server/Settings.scala
@@ -30,6 +30,7 @@ class SettingsImpl(config: Config) extends Extension {
val TrustedOrganizations: Set[String] = config.getStringList("savage.trusted-orgs").asScala.toSet
val SetCommitStatus: Boolean = config.getBoolean("savage.set-commit-status")
val TravisTimeout: FiniteDuration = config.getFiniteDuration("savage.travis-timeout")
+ val ShowPreviewUrls: Boolean = config.getBoolean("savage.show-preview-urls")
}
object Settings extends ExtensionId[SettingsImpl] with ExtensionIdProvider {
override def lookup() = Settings