Skip to content
This repository has been archived by the owner on Feb 10, 2021. It is now read-only.

Add option to show preview URL for the PR in the GitHub comment #42

Merged
merged 1 commit into from
Jul 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down