Skip to content

Commit

Permalink
Trigger workflow that have no options
Browse files Browse the repository at this point in the history
  • Loading branch information
canack committed Jan 6, 2024
1 parent 4581ddb commit 23b5149
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions internal/terminal/handler/ghtrigger/ghtrigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,6 @@ func (m *ModelGithubTrigger) syncWorkflowContent(ctx context.Context) {
return
}

if len(workflowContent.Workflow.KeyVals) == 0 &&
len(workflowContent.Workflow.Choices) == 0 &&
len(workflowContent.Workflow.Inputs) == 0 {
m.modelError.SetDefaultMessage(fmt.Sprintf("[%s@%s] No workflow contents found.",
m.SelectedRepository.RepositoryName, m.SelectedRepository.BranchName))
return
}

m.workflowContent = workflowContent.Workflow

var tableRowsTrigger []table.Row
Expand Down Expand Up @@ -441,8 +433,17 @@ func (m *ModelGithubTrigger) syncWorkflowContent(ctx context.Context) {

m.tableReady = true
m.isTriggerable = true
m.modelError.SetSuccessMessage(fmt.Sprintf("[%s@%s] Workflow contents fetched.",
m.SelectedRepository.RepositoryName, m.SelectedRepository.BranchName))

if len(workflowContent.Workflow.KeyVals) == 0 &&
len(workflowContent.Workflow.Choices) == 0 &&
len(workflowContent.Workflow.Inputs) == 0 {
m.modelError.SetDefaultMessage(fmt.Sprintf("[%s@%s] Workflow doesn't contain options but still triggerable",
m.SelectedRepository.RepositoryName, m.SelectedRepository.BranchName))
} else {
m.modelError.SetSuccessMessage(fmt.Sprintf("[%s@%s] Workflow contents fetched.",
m.SelectedRepository.RepositoryName, m.SelectedRepository.BranchName))
}

go m.Update(m) // update model
}

Expand Down

0 comments on commit 23b5149

Please sign in to comment.