Skip to content

Commit

Permalink
Print git status when CI status is not clean
Browse files Browse the repository at this point in the history
  • Loading branch information
davegaeddert committed Dec 14, 2020
1 parent 113b4bf commit d8867cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/git/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ func IsDirty() bool {
return cleaned != ""
}

func Status() string {
cmd := exec.Command("git", "status")
status, err := cmd.CombinedOutput()
if err != nil {
panic(err)
}
s := string(status)
return s
}

func run(args ...string) error {
cmdString := fmt.Sprintf("git %s", strings.Join(args, " "))
output.Debug(cmdString)
Expand Down
1 change: 1 addition & 0 deletions internal/runner/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func CI(autoconfigure bool, types []string) error {
}

if git.IsDirty() {
print(git.Status())
return errors.New("git status must be clean to run deps ci")
}

Expand Down

0 comments on commit d8867cf

Please sign in to comment.