@@ -10,8 +10,8 @@ import (
func (c *Client) ListEnvironments(
ctx context.Context,
projID, clusterID uint,
-) ([]*types.Environment, error) {
- var resp []*types.Environment
+) (*types.ListEnvironmentsResponse, error) {
+ resp := &types.ListEnvironmentsResponse{}
err := c.getRequest(
fmt.Sprintf("/projects/%d/clusters/%d/environments", projID, clusterID),
@@ -35,7 +35,7 @@ func (c *ListEnvironmentHandler) ServeHTTP(w http.ResponseWriter, r *http.Reques
return
}
- res := make([]*types.Environment, 0)
+ var res types.ListEnvironmentsResponse
for _, env := range envs {
environment := env.ToEnvironmentType()
@@ -110,3 +110,5 @@ type PullRequest struct {
BranchFrom string `json:"branch_from"`
BranchInto string `json:"branch_into"`
+
+type ListEnvironmentsResponse []*Environment
@@ -721,8 +721,9 @@ func (t *DeploymentHook) PreApply() error {
return err
- for _, env := range envList {
- fmt.Println(env)
+ envs := *envList
+ for _, env := range envs {
if env.GitRepoOwner == t.repoOwner && env.GitRepoName == t.repoName && env.GitInstallationID == t.gitInstallationID {
t.envID = env.ID
break