From 8d799c236c854c8bb132b38c97385beaf53d9327 Mon Sep 17 00:00:00 2001 From: badhezi Date: Tue, 15 Apr 2025 19:56:19 +0300 Subject: [PATCH 1/7] use the correct context data for PR link template in issue card --- templates/repo/issue/card.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/card.tmpl b/templates/repo/issue/card.tmpl index c7bbe91885012..41fe6cea8fbae 100644 --- a/templates/repo/issue/card.tmpl +++ b/templates/repo/issue/card.tmpl @@ -45,7 +45,7 @@ {{if $.Page.LinkedPRs}} {{range index $.Page.LinkedPRs .ID}}
- + {{svg "octicon-git-merge" 16 "tw-mr-1 tw-align-middle"}} {{.Title}} #{{.Index}} From 4e10abdb91a602fa0fa79d330b5c6588fa72aff2 Mon Sep 17 00:00:00 2001 From: badhezi Date: Wed, 8 Oct 2025 11:38:43 +0300 Subject: [PATCH 2/7] skip email notification trigger when run is not in final state --- services/mailer/mail_workflow_run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/mailer/mail_workflow_run.go b/services/mailer/mail_workflow_run.go index 37891028121c6..ed84e621ea4f6 100644 --- a/services/mailer/mail_workflow_run.go +++ b/services/mailer/mail_workflow_run.go @@ -153,7 +153,7 @@ func MailActionsTrigger(ctx context.Context, sender *user_model.User, repo *repo if setting.MailService == nil { return nil } - if !run.Status.IsDone() || run.Status.IsSkipped() { + if !run.Status.IsDone() || run.Status.IsSkipped() || (run.Started == 0 && run.Stopped == 0) { return nil } From c292ab2d09db5575fa2b070a8ee14fac6e0077f9 Mon Sep 17 00:00:00 2001 From: badhezi Date: Fri, 3 Oct 2025 16:25:42 +0300 Subject: [PATCH 3/7] update job.Status on re-run trigger to avoid duplicate email notifications --- routers/web/repo/actions/view.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 3422128026ffd..a84d554d4f069 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -420,11 +420,14 @@ func Rerun(ctx *context_module.Context) { return } - // reset run's start and stop time when it is done + // reset run's start and stop time when if is done if run.Status.IsDone() { run.PreviousDuration = run.Duration() run.Started = 0 run.Stopped = 0 + // Set run to waiting status so next job.Status evaluations reflect the status after the re-run trigger + // Avoid re-triggering email notification before the new job run ends + run.Status = 1 if err := actions_model.UpdateRun(ctx, run, "started", "stopped", "previous_duration"); err != nil { ctx.ServerError("UpdateRun", err) return From 43e1e02e599a7fa26bd17c7234d03cb66bdd1916 Mon Sep 17 00:00:00 2001 From: badhezi Date: Fri, 3 Oct 2025 16:29:13 +0300 Subject: [PATCH 4/7] fix comment --- routers/web/repo/actions/view.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index a84d554d4f069..35d1a73d83dd1 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -420,7 +420,7 @@ func Rerun(ctx *context_module.Context) { return } - // reset run's start and stop time when if is done + // reset run's start stop time and status if it is done if run.Status.IsDone() { run.PreviousDuration = run.Duration() run.Started = 0 From 54866908eaf2ba414748d29a9373b45338a5c801 Mon Sep 17 00:00:00 2001 From: badhezi Date: Fri, 3 Oct 2025 20:39:50 +0300 Subject: [PATCH 5/7] skip redundant workflow run status update --- routers/web/repo/actions/view.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 35d1a73d83dd1..8f567e2b9b9d4 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -420,14 +420,11 @@ func Rerun(ctx *context_module.Context) { return } - // reset run's start stop time and status if it is done + // reset run's start and stop time when it is done if run.Status.IsDone() { run.PreviousDuration = run.Duration() run.Started = 0 run.Stopped = 0 - // Set run to waiting status so next job.Status evaluations reflect the status after the re-run trigger - // Avoid re-triggering email notification before the new job run ends - run.Status = 1 if err := actions_model.UpdateRun(ctx, run, "started", "stopped", "previous_duration"); err != nil { ctx.ServerError("UpdateRun", err) return @@ -437,7 +434,6 @@ func Rerun(ctx *context_module.Context) { ctx.ServerError("run.LoadAttributes", err) return } - notify_service.WorkflowRunStatusUpdate(ctx, run.Repo, run.TriggerUser, run) } job, jobs := getRunJobs(ctx, runIndex, jobIndex) From 0281739039c83ac6554b7b58882daeef768064de Mon Sep 17 00:00:00 2001 From: badhezi Date: Wed, 8 Oct 2025 11:41:56 +0300 Subject: [PATCH 6/7] undo notify removal --- routers/web/repo/actions/view.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go index 8f567e2b9b9d4..3422128026ffd 100644 --- a/routers/web/repo/actions/view.go +++ b/routers/web/repo/actions/view.go @@ -434,6 +434,7 @@ func Rerun(ctx *context_module.Context) { ctx.ServerError("run.LoadAttributes", err) return } + notify_service.WorkflowRunStatusUpdate(ctx, run.Repo, run.TriggerUser, run) } job, jobs := getRunJobs(ctx, runIndex, jobIndex) From 62f86d1d038f9e94a075875514d52dfb8ed23e67 Mon Sep 17 00:00:00 2001 From: badhezi Date: Wed, 8 Oct 2025 14:48:04 +0300 Subject: [PATCH 7/7] comment to retrigger CI --- services/mailer/mail_workflow_run.go | 1 + 1 file changed, 1 insertion(+) diff --git a/services/mailer/mail_workflow_run.go b/services/mailer/mail_workflow_run.go index ed84e621ea4f6..6ad350f6461cc 100644 --- a/services/mailer/mail_workflow_run.go +++ b/services/mailer/mail_workflow_run.go @@ -153,6 +153,7 @@ func MailActionsTrigger(ctx context.Context, sender *user_model.User, repo *repo if setting.MailService == nil { return nil } + // Skip email if run just started if !run.Status.IsDone() || run.Status.IsSkipped() || (run.Started == 0 && run.Stopped == 0) { return nil }