File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -3627,6 +3627,7 @@ runs.scheduled = Scheduled
3627
3627
runs.pushed_by = pushed by
3628
3628
runs.invalid_workflow_helper = Workflow config file is invalid. Please check your config file: %s
3629
3629
runs.no_matching_online_runner_helper = No matching online runner with label: %s
3630
+ runs.no_job_without_needs = The workflow must contain at least one job with no dependencies.
3630
3631
runs.actor = Actor
3631
3632
runs.status = Status
3632
3633
runs.actors_no_select = All actors
Original file line number Diff line number Diff line change @@ -104,8 +104,13 @@ func List(ctx *context.Context) {
104
104
workflows = append (workflows , workflow )
105
105
continue
106
106
}
107
- // Check whether have matching runner
107
+ // The workflow must contain at least one job without "needs". Otherwise, a deadlock will occur and no jobs will be able to run.
108
+ hasJobWithoutNeeds := false
109
+ // Check whether have matching runner and a job without "needs"
108
110
for _ , j := range wf .Jobs {
111
+ if ! hasJobWithoutNeeds && len (j .Needs ()) == 0 {
112
+ hasJobWithoutNeeds = true
113
+ }
109
114
runsOnList := j .RunsOn ()
110
115
for _ , ro := range runsOnList {
111
116
if strings .Contains (ro , "${{" ) {
@@ -123,6 +128,9 @@ func List(ctx *context.Context) {
123
128
break
124
129
}
125
130
}
131
+ if ! hasJobWithoutNeeds {
132
+ workflow .ErrMsg = ctx .Locale .TrString ("actions.runs.no_job_without_needs" )
133
+ }
126
134
workflows = append (workflows , workflow )
127
135
}
128
136
}
You can’t perform that action at this time.
0 commit comments