Skip to content

Commit 21e7eef

Browse files
committed
fix
1 parent de570b7 commit 21e7eef

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

services/mailer/mail_workflow_run.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ func generateMessageIDForActionsWorkflowRunStatusEmail(repo *repo_model.Reposito
3434
}
3535

3636
func composeAndSendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo_model.Repository, run *actions_model.ActionRun, sender *user_model.User, recipients []*user_model.User) {
37+
jobs, err := actions_model.GetRunJobsByRunID(ctx, run.ID)
38+
if err != nil {
39+
log.Error("GetRunJobsByRunID: %v", err)
40+
return
41+
}
42+
for _, job := range jobs {
43+
if !job.Status.IsDone() {
44+
return
45+
}
46+
}
47+
3748
subject := "Run"
3849
switch run.Status {
3950
case actions_model.StatusFailure:
@@ -48,11 +59,6 @@ func composeAndSendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo
4859
messageID := generateMessageIDForActionsWorkflowRunStatusEmail(repo, run)
4960
metadataHeaders := generateMetadataHeaders(repo)
5061

51-
jobs, err := actions_model.GetRunJobsByRunID(ctx, run.ID)
52-
if err != nil {
53-
log.Error("GetRunJobsByRunID: %v", err)
54-
return
55-
}
5662
sort.SliceStable(jobs, func(i, j int) bool {
5763
si, sj := jobs[i].Status, jobs[j].Status
5864
/*

0 commit comments

Comments
 (0)