fix: keep original commit message

This commit is contained in:
Jason Song 2023-01-06 13:51:40 +08:00
parent ff75cbd81d
commit 326ae5d442
No known key found for this signature in database
GPG Key ID: 8402EEEE4511A8B5

View File

@ -21,7 +21,6 @@ import (
"code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
api "code.gitea.io/gitea/modules/structs" api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/convert" "code.gitea.io/gitea/services/convert"
"github.com/nektos/act/pkg/jobparser" "github.com/nektos/act/pkg/jobparser"
@ -139,7 +138,7 @@ func notify(ctx context.Context, input *notifyInput) error {
for id, content := range workflows { for id, content := range workflows {
run := actions_model.ActionRun{ run := actions_model.ActionRun{
Title: truncateContent(strings.SplitN(commit.CommitMessage, "\n", 2)[0], 255), Title: strings.SplitN(commit.CommitMessage, "\n", 2)[0],
RepoID: input.Repo.ID, RepoID: input.Repo.ID,
OwnerID: input.Repo.OwnerID, OwnerID: input.Repo.OwnerID,
WorkflowID: id, WorkflowID: id,
@ -219,11 +218,3 @@ func notifyPackage(ctx context.Context, sender *user_model.User, pd *packages_mo
}). }).
Notify(ctx) Notify(ctx)
} }
func truncateContent(content string, n int) string {
truncated, omitted := util.SplitStringAtByteN(content, n)
if omitted != "" {
truncated += "…"
}
return truncated
}