Skip to content

Commit

Permalink
also disallow push after merged
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanleiby committed Feb 7, 2018
1 parent 38942a3 commit 61c651f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"path/filepath"

"github.com/Clever/microplane/initialize"
"github.com/Clever/microplane/merge"
"github.com/Clever/microplane/plan"
"github.com/Clever/microplane/push"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -51,6 +52,16 @@ var pushCmd = &cobra.Command{
func pushOneRepo(r initialize.Repo, ctx context.Context) error {
log.Printf("pushing: %s/%s", r.Owner, r.Name)

// Exit early if already merged
var mergeOutput struct {
merge.Output
Error string
}
if loadJSON(outputPath(r.Name, "merge"), &mergeOutput) == nil && mergeOutput.Success {
log.Printf("%s/%s - already merged", r.Owner, r.Name)
return nil
}

// Get previous step's output
var planOutput plan.Output
if loadJSON(outputPath(r.Name, "plan"), &planOutput) != nil || !planOutput.Success {
Expand Down

0 comments on commit 61c651f

Please sign in to comment.