@@ -33,6 +33,7 @@ import (
33
33
"code.gitea.io/gitea/modules/web"
34
34
actions_service "code.gitea.io/gitea/services/actions"
35
35
context_module "code.gitea.io/gitea/services/context"
36
+ notify_service "code.gitea.io/gitea/services/notify"
36
37
37
38
"github.com/nektos/act/pkg/model"
38
39
"xorm.io/builder"
@@ -458,6 +459,9 @@ func rerunJob(ctx *context_module.Context, job *actions_model.ActionRunJob, shou
458
459
}
459
460
460
461
actions_service .CreateCommitStatus (ctx , job )
462
+ _ = job .LoadAttributes (ctx )
463
+ notify_service .WorkflowJobStatusUpdate (ctx , job .Run .Repo , job .Run .TriggerUser , job , nil )
464
+
461
465
return nil
462
466
}
463
467
@@ -518,6 +522,8 @@ func Cancel(ctx *context_module.Context) {
518
522
return
519
523
}
520
524
525
+ var updatedjobs []* actions_model.ActionRunJob
526
+
521
527
if err := db .WithTx (ctx , func (ctx context.Context ) error {
522
528
for _ , job := range jobs {
523
529
status := job .Status
@@ -534,6 +540,9 @@ func Cancel(ctx *context_module.Context) {
534
540
if n == 0 {
535
541
return fmt .Errorf ("job has changed, try again" )
536
542
}
543
+ if n > 0 {
544
+ updatedjobs = append (updatedjobs , job )
545
+ }
537
546
continue
538
547
}
539
548
if err := actions_model .StopTask (ctx , job .TaskID , actions_model .StatusCancelled ); err != nil {
@@ -548,6 +557,11 @@ func Cancel(ctx *context_module.Context) {
548
557
549
558
actions_service .CreateCommitStatus (ctx , jobs ... )
550
559
560
+ for _ , job := range updatedjobs {
561
+ _ = job .LoadAttributes (ctx )
562
+ notify_service .WorkflowJobStatusUpdate (ctx , job .Run .Repo , job .Run .TriggerUser , job , nil )
563
+ }
564
+
551
565
ctx .JSON (http .StatusOK , struct {}{})
552
566
}
553
567
@@ -561,6 +575,8 @@ func Approve(ctx *context_module.Context) {
561
575
run := current .Run
562
576
doer := ctx .Doer
563
577
578
+ var updatedjobs []* actions_model.ActionRunJob
579
+
564
580
if err := db .WithTx (ctx , func (ctx context.Context ) error {
565
581
run .NeedApproval = false
566
582
run .ApprovedBy = doer .ID
@@ -570,10 +586,13 @@ func Approve(ctx *context_module.Context) {
570
586
for _ , job := range jobs {
571
587
if len (job .Needs ) == 0 && job .Status .IsBlocked () {
572
588
job .Status = actions_model .StatusWaiting
573
- _ , err := actions_model .UpdateRunJob (ctx , job , nil , "status" )
589
+ n , err := actions_model .UpdateRunJob (ctx , job , nil , "status" )
574
590
if err != nil {
575
591
return err
576
592
}
593
+ if n > 0 {
594
+ updatedjobs = append (updatedjobs , job )
595
+ }
577
596
}
578
597
}
579
598
return nil
@@ -584,6 +603,11 @@ func Approve(ctx *context_module.Context) {
584
603
585
604
actions_service .CreateCommitStatus (ctx , jobs ... )
586
605
606
+ for _ , job := range updatedjobs {
607
+ _ = job .LoadAttributes (ctx )
608
+ notify_service .WorkflowJobStatusUpdate (ctx , job .Run .Repo , job .Run .TriggerUser , job , nil )
609
+ }
610
+
587
611
ctx .JSON (http .StatusOK , struct {}{})
588
612
}
589
613
0 commit comments