Skip to content

Commit

Permalink
fix: only add a commit to the local env repo if there are outstanding…
Browse files Browse the repository at this point in the history
… changes
  • Loading branch information
hferentschik committed Oct 10, 2019
1 parent 76705ed commit 7cf5fb9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pkg/cmd/step/verify/step_verify_environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,21 @@ func (o *StepVerifyEnvironmentsOptions) pushDevEnvironmentUpdates(environmentRep
return errors.Wrap(err, "failed to modify dev environment config")
}

err = gitter.Add(localRepoDir, ".")
hasChanges, err := gitter.HasChanges(localRepoDir)
if err != nil {
return errors.Wrap(err, "unable to add stage commit")
return errors.Wrap(err, "unable to check for changes")
}

err = gitter.CommitDir(localRepoDir, "chore(config): update configuration")
if err != nil {
return errors.Wrapf(err, "unable to commit changes to environment repo in %s", localRepoDir)
if hasChanges {
err = gitter.Add(localRepoDir, ".")
if err != nil {
return errors.Wrap(err, "unable to add stage commit")
}

err = gitter.CommitDir(localRepoDir, "chore(config): update configuration")
if err != nil {
return errors.Wrapf(err, "unable to commit changes to environment repo in %s", localRepoDir)
}
}

userDetails := provider.UserAuth()
Expand Down

0 comments on commit 7cf5fb9

Please sign in to comment.