Skip to content

Commit

Permalink
Merge pull request #97 from CircleCI-Public/promote-new
Browse files Browse the repository at this point in the history
Start from 0.0.0 if no previous version is found through inc/promote
  • Loading branch information
Zachary Scott authored Sep 5, 2018
2 parents d9f59f7 + 985cb72 commit 43c4b7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ func OrbIncrementVersion(ctx context.Context, logger *logger.Logger, configPath
}

// OrbLatestVersion finds the latest published version of an orb and returns it.
// If it doesn't find a version, it will return 0.0.0 for the orb's version
func OrbLatestVersion(ctx context.Context, logger *logger.Logger, namespace string, orb string) (string, error) {
name := namespace + "/" + orb

Expand Down Expand Up @@ -618,7 +619,7 @@ func OrbLatestVersion(ctx context.Context, logger *logger.Logger, namespace stri
}

if len(response.Orb.Versions) != 1 {
return "", fmt.Errorf("the %s orb has never published a revision", name)
return "0.0.0", nil
}

return response.Orb.Versions[0].Version, nil
Expand Down

0 comments on commit 43c4b7a

Please sign in to comment.