Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit task actions to 10 #1964

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/api/graphql_root_playbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ func validateUpdateTaskActions(checklists []UpdateChecklist) error {
for _, checklist := range checklists {
for _, item := range checklist.Items {
if taskActions := item.TaskActions; taskActions != nil {
// Limit task actions to 10
if len(*taskActions) > 10 {
return errors.Errorf("playbook cannot have more than 10 task actions")
}
for _, ta := range *taskActions {
if err := app.ValidateTrigger(ta.Trigger); err != nil {
return err
Expand Down
5 changes: 5 additions & 0 deletions server/api/playbooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ func validatePreAssignment(pb app.Playbook) error {
// validateTaskActions validates the taskactions in the given checklist
// NOTE: Any changes to this function must be made to function 'validateUpdateTaskActions' for the GraphQL endpoint.
func validateTaskActions(taskActions []app.TaskAction) error {
// Limit task actions to 10
if len(taskActions) > 10 {
return errors.Errorf("playbook cannot have more than 10 task actions")
}

for _, ta := range taskActions {
if err := app.ValidateTrigger(ta.Trigger); err != nil {
return err
Expand Down
Loading