@@ -197,7 +197,7 @@ func ShouldBlockJobByConcurrency(ctx context.Context, job *ActionRunJob) (bool,
197
197
return false , nil
198
198
}
199
199
if ! job .IsConcurrencyEvaluated {
200
- return false , fmt . Errorf ( "the raw concurrency group has not been evaluated" )
200
+ return false , ErrUnevaluatedConcurrency {}
201
201
}
202
202
if len (job .ConcurrencyGroup ) == 0 || job .ConcurrencyCancel {
203
203
return false , nil
@@ -225,7 +225,7 @@ func ShouldBlockJobByConcurrency(ctx context.Context, job *ActionRunJob) (bool,
225
225
func CancelPreviousJobsByConcurrency (ctx context.Context , job * ActionRunJob ) error {
226
226
if len (job .RawConcurrencyGroup ) > 0 {
227
227
if ! job .IsConcurrencyEvaluated {
228
- return fmt . Errorf ( "the raw concurrency group has not been evaluated" )
228
+ return ErrUnevaluatedConcurrency {}
229
229
}
230
230
if len (job .ConcurrencyGroup ) > 0 && job .ConcurrencyCancel {
231
231
// cancel previous jobs in the same concurrency group
@@ -274,3 +274,15 @@ func CancelPreviousJobsByConcurrency(ctx context.Context, job *ActionRunJob) err
274
274
275
275
return nil
276
276
}
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
+ }
0 commit comments