@@ -33,16 +33,15 @@ func generateMessageIDForActionsWorkflowRunStatusEmail(repo *repo_model.Reposito
3333	return  fmt .Sprintf ("<%s/actions/runs/%d@%s>" , repo .FullName (), run .Index , setting .Domain )
3434}
3535
36- func  composeAndSendActionsWorkflowRunStatusEmail (ctx  context.Context , repo  * repo_model.Repository , run  * actions_model.ActionRun , sender  * user_model.User , recipients  []* user_model.User ) {
36+ func  composeAndSendActionsWorkflowRunStatusEmail (ctx  context.Context , repo  * repo_model.Repository , run  * actions_model.ActionRun , sender  * user_model.User , recipients  []* user_model.User ) error   {
3737	jobs , err  :=  actions_model .GetRunJobsByRunID (ctx , run .ID )
3838	if  err  !=  nil  {
39- 		log .Error ("GetRunJobsByRunID: %v" , err )
40- 		return 
39+ 		return  err 
4140	}
4241	for  _ , job  :=  range  jobs  {
4342		if  ! job .Status .IsDone () {
44- 			log .Trace ("composeAndSendActionsWorkflowRunStatusEmail: A job is not done. Will not compose and send actions email." )
45- 			return 
43+ 			log .Debug ("composeAndSendActionsWorkflowRunStatusEmail: A job is not done. Will not compose and send actions email." )
44+ 			return   nil 
4645		}
4746	}
4847
@@ -118,8 +117,7 @@ func composeAndSendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo
118117			"Jobs" :          convertedJobs ,
119118			"locale" :        locale ,
120119		}); err  !=  nil  {
121- 			log .Error ("ExecuteTemplate [%s]: %v" , tplWorkflowRun , err )
122- 			return 
120+ 			return  err 
123121		}
124122		msgs  :=  make ([]* sender_service.Message , 0 , len (tos ))
125123		for  _ , rec  :=  range  tos  {
@@ -143,14 +141,16 @@ func composeAndSendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo
143141		}
144142		SendAsync (msgs ... )
145143	}
144+ 
145+ 	return  nil 
146146}
147147
148- func  MailActionsTrigger (ctx  context.Context , sender  * user_model.User , repo  * repo_model.Repository , run  * actions_model.ActionRun ) {
148+ func  MailActionsTrigger (ctx  context.Context , sender  * user_model.User , repo  * repo_model.Repository , run  * actions_model.ActionRun ) error   {
149149	if  setting .MailService  ==  nil  {
150- 		return 
150+ 		return   nil 
151151	}
152152	if  ! run .Status .IsDone () ||  run .Status .IsSkipped () {
153- 		return 
153+ 		return   nil 
154154	}
155155
156156	recipients  :=  make ([]* user_model.User , 0 )
@@ -159,16 +159,16 @@ func MailActionsTrigger(ctx context.Context, sender *user_model.User, repo *repo
159159		notifyPref , err  :=  user_model .GetUserSetting (ctx , sender .ID ,
160160			user_model .SettingsKeyEmailNotificationGiteaActions , user_model .SettingEmailNotificationGiteaActionsFailureOnly )
161161		if  err  !=  nil  {
162- 			log .Error ("GetUserSetting: %v" , err )
163- 			return 
162+ 			return  err 
164163		}
165164		if  notifyPref  ==  user_model .SettingEmailNotificationGiteaActionsAll  ||  ! run .Status .IsSuccess () &&  notifyPref  !=  user_model .SettingEmailNotificationGiteaActionsDisabled  {
166165			recipients  =  append (recipients , sender )
167166		}
168167	}
169168
170169	if  len (recipients ) >  0  {
171- 		log .Trace ("MailActionsTrigger: Initiate email composition" )
172- 		composeAndSendActionsWorkflowRunStatusEmail (ctx , repo , run , sender , recipients )
170+ 		log .Debug ("MailActionsTrigger: Initiate email composition" )
171+ 		return   composeAndSendActionsWorkflowRunStatusEmail (ctx , repo , run , sender , recipients )
173172	}
173+ 	return  nil 
174174}
0 commit comments