Skip to content

Commit d5168a2

Browse files
committed
fix
1 parent 57c0d5c commit d5168a2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Diff for: models/actions/run_job.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func ShouldBlockJobByConcurrency(ctx context.Context, job *ActionRunJob) (bool,
197197
return false, nil
198198
}
199199
if !job.IsConcurrencyEvaluated {
200-
return false, fmt.Errorf("the raw concurrency group has not been evaluated")
200+
return false, ErrUnevaluatedConcurrency{}
201201
}
202202
if len(job.ConcurrencyGroup) == 0 || job.ConcurrencyCancel {
203203
return false, nil
@@ -225,7 +225,7 @@ func ShouldBlockJobByConcurrency(ctx context.Context, job *ActionRunJob) (bool,
225225
func CancelPreviousJobsByConcurrency(ctx context.Context, job *ActionRunJob) error {
226226
if len(job.RawConcurrencyGroup) > 0 {
227227
if !job.IsConcurrencyEvaluated {
228-
return fmt.Errorf("the raw concurrency group has not been evaluated")
228+
return ErrUnevaluatedConcurrency{}
229229
}
230230
if len(job.ConcurrencyGroup) > 0 && job.ConcurrencyCancel {
231231
// cancel previous jobs in the same concurrency group
@@ -274,3 +274,15 @@ func CancelPreviousJobsByConcurrency(ctx context.Context, job *ActionRunJob) err
274274

275275
return nil
276276
}
277+
278+
type ErrUnevaluatedConcurrency struct {
279+
}
280+
281+
func IsErrUnevaluatedConcurrency(err error) bool {
282+
_, ok := err.(ErrUnevaluatedConcurrency)
283+
return ok
284+
}
285+
286+
func (err ErrUnevaluatedConcurrency) Error() string {
287+
return "the raw concurrency group has not been evaluated"
288+
}

Diff for: routers/web/repo/actions/view.go

+3
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,9 @@ func Approve(ctx *context_module.Context) {
562562
for _, job := range jobs {
563563
blockJobByConcurrency, err := actions_model.ShouldBlockJobByConcurrency(ctx, job)
564564
if err != nil {
565+
if actions_model.IsErrUnevaluatedConcurrency(err) {
566+
continue
567+
}
565568
return err
566569
}
567570
if len(job.Needs) == 0 && job.Status.IsBlocked() && !blockJobByConcurrency {

0 commit comments

Comments
 (0)