Skip to content

Commit 67a3227

Browse files
committed
Adjust appearence of commit status webhook
1 parent 43c8d85 commit 67a3227

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

services/webhook/general.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"net/url"
1010
"strings"
1111

12+
user_model "code.gitea.io/gitea/models/user"
1213
webhook_model "code.gitea.io/gitea/models/webhook"
1314
"code.gitea.io/gitea/modules/setting"
1415
api "code.gitea.io/gitea/modules/structs"
@@ -308,12 +309,16 @@ func getPackagePayloadInfo(p *api.PackagePayload, linkFormatter linkFormatter, w
308309
}
309310

310311
func getStatusPayloadInfo(p *api.CommitStatusPayload, linkFormatter linkFormatter, withSender bool) (text string, color int) {
311-
refLink := linkFormatter(p.TargetURL, p.Context+"["+p.SHA+"]:"+p.Description)
312+
refLink := linkFormatter(p.TargetURL, fmt.Sprintf("%s [%s]", p.Context, p.SHA[:7]))
312313

313-
text = fmt.Sprintf("Commit Status changed: %s", refLink)
314+
text = fmt.Sprintf("Commit Status changed: %s - %s", refLink, p.Description)
314315
color = greenColor
315316
if withSender {
316-
text += fmt.Sprintf(" by %s", linkFormatter(setting.AppURL+url.PathEscape(p.Sender.UserName), p.Sender.UserName))
317+
if user_model.IsGiteaActionsUserName(p.Sender.UserName) {
318+
text += fmt.Sprintf(" by %s", p.Sender.FullName)
319+
} else {
320+
text += fmt.Sprintf(" by %s", linkFormatter(setting.AppURL+url.PathEscape(p.Sender.UserName), p.Sender.UserName))
321+
}
317322
}
318323

319324
return text, color

0 commit comments

Comments
 (0)