MCPcopy Create free account
hub / github.com/github/gh-aw / validateJobDefinition

Function validateJobDefinition

pkg/workflow/jobs_validation.go:27–49  ·  view source on GitHub ↗
(job *Job)

Source from the content-addressed store, hash-verified

25)
26
27func validateJobDefinition(job *Job) error {
28 if job == nil {
29 return errors.New("job definition cannot be nil")
30 }
31
32 if job.Uses != "" && (job.TimeoutMinutes > 0 || job.TimeoutMinutesExpression != "") {
33 return fmt.Errorf(
34 "job '%s' uses a reusable workflow and cannot set timeout-minutes; remove timeout-minutes from the caller job or move it into the called workflow",
35 job.Name,
36 )
37 }
38
39 if job.TimeoutMinutes > 0 && job.TimeoutMinutesExpression != "" {
40 return fmt.Errorf(
41 "job '%s' has timeout-minutes set as both integer (%d) and expression (%q); specify only one",
42 job.Name,
43 job.TimeoutMinutes,
44 job.TimeoutMinutesExpression,
45 )
46 }
47
48 return nil
49}
50
51// ValidateDependencies checks that all job dependencies exist and there are no cycles
52func (jm *JobManager) ValidateDependencies() error {

Callers 1

AddJobMethod · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected