@@ -33,6 +33,7 @@ import (
3333 "code.gitea.io/gitea/modules/web"
3434 actions_service "code.gitea.io/gitea/services/actions"
3535 context_module "code.gitea.io/gitea/services/context"
36+ notify_service "code.gitea.io/gitea/services/notify"
3637
3738 "github.com/nektos/act/pkg/model"
3839 "xorm.io/builder"
@@ -458,6 +459,9 @@ func rerunJob(ctx *context_module.Context, job *actions_model.ActionRunJob, shou
458459 }
459460
460461 actions_service .CreateCommitStatus (ctx , job )
462+ _ = job .LoadAttributes (ctx )
463+ notify_service .WorkflowJobStatusUpdate (ctx , job .Run .Repo , job .Run .TriggerUser , job , nil )
464+
461465 return nil
462466}
463467
@@ -518,6 +522,8 @@ func Cancel(ctx *context_module.Context) {
518522 return
519523 }
520524
525+ var updatedjobs []* actions_model.ActionRunJob
526+
521527 if err := db .WithTx (ctx , func (ctx context.Context ) error {
522528 for _ , job := range jobs {
523529 status := job .Status
@@ -534,6 +540,9 @@ func Cancel(ctx *context_module.Context) {
534540 if n == 0 {
535541 return fmt .Errorf ("job has changed, try again" )
536542 }
543+ if n > 0 {
544+ updatedjobs = append (updatedjobs , job )
545+ }
537546 continue
538547 }
539548 if err := actions_model .StopTask (ctx , job .TaskID , actions_model .StatusCancelled ); err != nil {
@@ -548,6 +557,11 @@ func Cancel(ctx *context_module.Context) {
548557
549558 actions_service .CreateCommitStatus (ctx , jobs ... )
550559
560+ for _ , job := range updatedjobs {
561+ _ = job .LoadAttributes (ctx )
562+ notify_service .WorkflowJobStatusUpdate (ctx , job .Run .Repo , job .Run .TriggerUser , job , nil )
563+ }
564+
551565 ctx .JSON (http .StatusOK , struct {}{})
552566}
553567
@@ -561,6 +575,8 @@ func Approve(ctx *context_module.Context) {
561575 run := current .Run
562576 doer := ctx .Doer
563577
578+ var updatedjobs []* actions_model.ActionRunJob
579+
564580 if err := db .WithTx (ctx , func (ctx context.Context ) error {
565581 run .NeedApproval = false
566582 run .ApprovedBy = doer .ID
@@ -570,10 +586,13 @@ func Approve(ctx *context_module.Context) {
570586 for _ , job := range jobs {
571587 if len (job .Needs ) == 0 && job .Status .IsBlocked () {
572588 job .Status = actions_model .StatusWaiting
573- _ , err := actions_model .UpdateRunJob (ctx , job , nil , "status" )
589+ n , err := actions_model .UpdateRunJob (ctx , job , nil , "status" )
574590 if err != nil {
575591 return err
576592 }
593+ if n > 0 {
594+ updatedjobs = append (updatedjobs , job )
595+ }
577596 }
578597 }
579598 return nil
@@ -584,6 +603,11 @@ func Approve(ctx *context_module.Context) {
584603
585604 actions_service .CreateCommitStatus (ctx , jobs ... )
586605
606+ for _ , job := range updatedjobs {
607+ _ = job .LoadAttributes (ctx )
608+ notify_service .WorkflowJobStatusUpdate (ctx , job .Run .Repo , job .Run .TriggerUser , job , nil )
609+ }
610+
587611 ctx .JSON (http .StatusOK , struct {}{})
588612}
589613
0 commit comments