Skip to content

Commit 8444d46

Browse files
committed
allow all valid job types
1 parent ddc9afb commit 8444d46

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

pkg/parser/validate/workflow.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,22 @@ func (val Validate) validateSingleWorkflow(workflow ast.Workflow) error {
2020
continue
2121
}
2222

23-
isApprovalJob := jobRef.Type == "approval"
24-
if isApprovalJob {
23+
// Define valid job types
24+
validJobTypesMap := map[string]bool{
25+
"approval": true,
26+
"build": true,
27+
"no-op": true,
28+
"release": true,
29+
}
30+
31+
// Direct lookup in the map
32+
if validJobTypesMap[jobRef.Type] {
2533
continue
2634
}
2735

2836
jobTypeIsDefined := jobRef.Type != ""
2937
if jobTypeIsDefined {
30-
val.addDiagnostic(utils.CreateErrorDiagnosticFromRange(jobRef.TypeRange, "Type can only be \"approval\""))
38+
val.addDiagnostic(utils.CreateErrorDiagnosticFromRange(jobRef.TypeRange, fmt.Sprintf("Job Type \"%s\" is not valid", jobRef.Type)))
3139
continue
3240
}
3341

0 commit comments

Comments
 (0)