|
8 | 8 |
|
9 | 9 | "github.com/Masterminds/semver/v3" |
10 | 10 | "github.com/go-semantic-release/plugin-registry/pkg/client" |
| 11 | + "github.com/go-semantic-release/plugin-registry/pkg/registry" |
11 | 12 | "github.com/go-semantic-release/semantic-release/v2/pkg/plugin" |
12 | 13 | "github.com/go-semantic-release/semantic-release/v2/pkg/plugin/discovery/resolver" |
13 | 14 | ) |
@@ -82,7 +83,30 @@ func (r *Resolver) ResolvePlugin(pluginInfo *plugin.Info) (*resolver.PluginDownl |
82 | 83 | } |
83 | 84 |
|
84 | 85 | func (r *Resolver) BatchResolvePlugins(pluginInfos []*plugin.Info) (*resolver.BatchPluginDownloadInfo, error) { |
85 | | - return nil, fmt.Errorf("not implemented") |
| 86 | + batchRequest := ®istry.BatchRequest{ |
| 87 | + OS: runtime.GOOS, |
| 88 | + Arch: runtime.GOARCH, |
| 89 | + Plugins: make([]*registry.BatchRequestPlugin, len(pluginInfos)), |
| 90 | + } |
| 91 | + for i, pluginInfo := range pluginInfos { |
| 92 | + versionConstraint := "" |
| 93 | + if pluginInfo.Constraint != nil { |
| 94 | + versionConstraint = pluginInfo.Constraint.String() |
| 95 | + } |
| 96 | + batchRequest.Plugins[i] = ®istry.BatchRequestPlugin{ |
| 97 | + FullName: pluginInfo.ShortNormalizedName, |
| 98 | + VersionConstraint: versionConstraint, |
| 99 | + } |
| 100 | + } |
| 101 | + batchResponse, err := r.client.SendBatchRequest(context.Background(), batchRequest) |
| 102 | + if err != nil { |
| 103 | + return nil, err |
| 104 | + } |
| 105 | + |
| 106 | + return &resolver.BatchPluginDownloadInfo{ |
| 107 | + URL: batchResponse.DownloadURL, |
| 108 | + Checksum: batchResponse.DownloadChecksum, |
| 109 | + }, nil |
86 | 110 | } |
87 | 111 |
|
88 | 112 | func (r *Resolver) Names() []string { |
|
0 commit comments