From 2470bc3fb6ce069929f407a32ccfb9b3d19df570 Mon Sep 17 00:00:00 2001 From: zimbatm Date: Wed, 1 May 2019 19:16:10 +0200 Subject: [PATCH] restore the original environment name logic --- command/please.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/command/please.go b/command/please.go index 0c97afa..71a2f2f 100644 --- a/command/please.go +++ b/command/please.go @@ -3,6 +3,7 @@ package command import ( "context" "errors" + "fmt" "log" "os" "os/exec" @@ -53,15 +54,9 @@ func CmdPlease(c *cli.Context) (err error) { } } - // If the environment is not set, set as follows: - // * branch is master: production - // * otherwise: pr-preview - if environment == "" { - if branch == "master" { - environment = "production" - } else { - environment = "pr-preview" - } + // Override the deployment target on pull-request + if pr > 0 { + environment = fmt.Sprintf("pr-%d", pr) } ctx := context.Background()