Skip to content

Commit

Permalink
Merge pull request #13 from futuregadgetlabx/feat/pr_ci
Browse files Browse the repository at this point in the history
fix send feishu message failed when git commit contains line break
  • Loading branch information
mozhu811 authored Oct 13, 2023
2 parents 176cf58 + f4c72d6 commit 718542a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func run(c *cli.Context) error {
},
Pull: c.String("commit.pull"),
PullRequestTitle: c.String("commit.pull.title"),
CommitMessage: c.String("commit.message"),
CommitMessage: buildCommitMessage(c.String("commit.message")),
Link: c.String("build.link"),
Started: time.Unix(c.Int64("build.started"), 0).Format("2006-01-02 15:04:05"),
Created: time.Unix(c.Int64("build.created"), 0).Format("2006-01-02 15:04:05"),
Expand Down
9 changes: 9 additions & 0 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"log"
"net/http"
"os"
"strings"
)

type (
Expand Down Expand Up @@ -72,6 +73,14 @@ type (
}
)

func (c CommitMessage) String() string {
return c.msg
}

func buildCommitMessage(m string) string {
return strings.ReplaceAll(m, "\n", "\\n")
}

func (p Plugin) Exec() error {
// Get tenant access token
tokenReq := request.GetTokenReq{
Expand Down

0 comments on commit 718542a

Please sign in to comment.