UpdateTask
client.Environments.Automations.Tasks.Update(ctx, body) (*EnvironmentAutomationTaskUpdateResponse, error)
POST/gitpod.v1.EnvironmentAutomationService/UpdateTask
Updates an automation task configuration.
Use this method to:
- Modify task commands
- Update task triggers
- Change dependencies
- Adjust execution settings
Examples
-
Update command:
Changes the task’s command.
id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" spec: command: "npm run test:coverage" -
Update triggers:
Modifies when the task runs.
id: "d2c94c27-3b76-4a42-b88c-95a85e392c68" metadata: triggeredBy: trigger: - postEnvironmentStart: true
UpdateTask
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
task, err := client.Environments.Automations.Tasks.Update(context.TODO(), gitpod.EnvironmentAutomationTaskUpdateParams{
ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
Spec: gitpod.F(gitpod.EnvironmentAutomationTaskUpdateParamsSpec{
Command: gitpod.F("npm run test:coverage"),
}),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", task)
}
{}Returns Examples
{}