diff --git a/testdata/messages/summarycomment/structure/summary_comment_pr_issues_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_issues_pr_entitled.md
similarity index 100%
rename from testdata/messages/summarycomment/structure/summary_comment_pr_issues_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_issues_pr_entitled.md
diff --git a/testdata/messages/summarycomment/structure/summary_comment_pr_issues_not_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_issues_pr_not_entitled.md
similarity index 94%
rename from testdata/messages/summarycomment/structure/summary_comment_pr_issues_not_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_issues_pr_not_entitled.md
index b71d8dafe..ed749a21c 100644
--- a/testdata/messages/summarycomment/structure/summary_comment_pr_issues_not_entitled.md
+++ b/testdata/messages/summarycomment/structure/summary_comment_issues_pr_not_entitled.md
@@ -9,7 +9,8 @@
some content
```
diff --git a/testdata/messages/summarycomment/structure/summary_comment_pr_issues_not_entitled_with_title.md b/testdata/messages/summarycomment/structure/summary_comment_issues_pr_not_entitled_with_title.md
similarity index 91%
rename from testdata/messages/summarycomment/structure/summary_comment_pr_issues_not_entitled_with_title.md
rename to testdata/messages/summarycomment/structure/summary_comment_issues_pr_not_entitled_with_title.md
index dbe12d75b..934ef3511 100644
--- a/testdata/messages/summarycomment/structure/summary_comment_pr_issues_not_entitled_with_title.md
+++ b/testdata/messages/summarycomment/structure/summary_comment_issues_pr_not_entitled_with_title.md
@@ -4,13 +4,14 @@
diff --git a/testdata/messages/summarycomment/structure/summary_comment_simplified_issues_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_issues_simplified_entitled.md
similarity index 100%
rename from testdata/messages/summarycomment/structure/summary_comment_simplified_issues_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_issues_simplified_entitled.md
diff --git a/testdata/messages/summarycomment/structure/summary_comment_simplified_issues_entitled_with_title.md b/testdata/messages/summarycomment/structure/summary_comment_issues_simplified_entitled_with_title.md
similarity index 84%
rename from testdata/messages/summarycomment/structure/summary_comment_simplified_issues_entitled_with_title.md
rename to testdata/messages/summarycomment/structure/summary_comment_issues_simplified_entitled_with_title.md
index 2de08677a..db00cf9e7 100644
--- a/testdata/messages/summarycomment/structure/summary_comment_simplified_issues_entitled_with_title.md
+++ b/testdata/messages/summarycomment/structure/summary_comment_issues_simplified_entitled_with_title.md
@@ -1,6 +1,9 @@
**🚨 Frogbot scanned this pull request and found the below:**
-**Test Build**
+---
+## **Custom title**
+
+---
```
some content
diff --git a/testdata/messages/summarycomment/structure/summary_comment_simplified_issues_not_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_issues_simplified_not_entitled.md
similarity index 97%
rename from testdata/messages/summarycomment/structure/summary_comment_simplified_issues_not_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_issues_simplified_not_entitled.md
index 0aa4499c0..9beca5f01 100644
--- a/testdata/messages/summarycomment/structure/summary_comment_simplified_issues_not_entitled.md
+++ b/testdata/messages/summarycomment/structure/summary_comment_issues_simplified_not_entitled.md
@@ -4,8 +4,11 @@
some content
```
+---
Note:
+---
+
---
**Frogbot** also supports **Contextual Analysis, Secret Detection, IaC and SAST Vulnerabilities Scanning**. This features are included as part of the [JFrog Advanced Security](https://jfrog.com/advanced-security) package, which isn't enabled on your system.
diff --git a/testdata/messages/summarycomment/structure/summary_comment_mr_no_issues_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_mr_entitled.md
similarity index 100%
rename from testdata/messages/summarycomment/structure/summary_comment_mr_no_issues_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_no_issues_mr_entitled.md
diff --git a/testdata/messages/summarycomment/structure/summary_comment_mr_no_issues_not_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_mr_not_entitled.md
similarity index 94%
rename from testdata/messages/summarycomment/structure/summary_comment_mr_no_issues_not_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_no_issues_mr_not_entitled.md
index f8d9e3452..e394b6a49 100644
--- a/testdata/messages/summarycomment/structure/summary_comment_mr_no_issues_not_entitled.md
+++ b/testdata/messages/summarycomment/structure/summary_comment_no_issues_mr_not_entitled.md
@@ -5,7 +5,8 @@
diff --git a/testdata/messages/summarycomment/structure/summary_comment_pr_no_issues_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_entitled.md
similarity index 100%
rename from testdata/messages/summarycomment/structure/summary_comment_pr_no_issues_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_entitled.md
diff --git a/testdata/messages/summarycomment/structure/summary_comment_pr_no_issues_not_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_not_entitled.md
similarity index 94%
rename from testdata/messages/summarycomment/structure/summary_comment_pr_no_issues_not_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_not_entitled.md
index 19b709205..2c60fb1fe 100644
--- a/testdata/messages/summarycomment/structure/summary_comment_pr_no_issues_not_entitled.md
+++ b/testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_not_entitled.md
@@ -5,7 +5,8 @@
diff --git a/testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_not_entitled_with_title.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_not_entitled_with_title.md
new file mode 100644
index 000000000..8e98aef88
--- /dev/null
+++ b/testdata/messages/summarycomment/structure/summary_comment_no_issues_pr_not_entitled_with_title.md
@@ -0,0 +1,28 @@
+
+
+[![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/noVulnerabilityBannerPR.png)](https://github.com/jfrog/frogbot#readme)
+
+
+
+## **Custom title**
+
+ Note:
+
+
+---
+
+
+**Frogbot** also supports **Contextual Analysis, Secret Detection, IaC and SAST Vulnerabilities Scanning**. This features are included as part of the [JFrog Advanced Security](https://jfrog.com/advanced-security) package, which isn't enabled on your system.
+
+
+
+
+
+
+
+---
+
+
+[🐸 JFrog Frogbot](https://github.com/jfrog/frogbot#readme)
+
+
diff --git a/testdata/messages/summarycomment/structure/summary_comment_simplified_no_issues_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_entitled.md
similarity index 100%
rename from testdata/messages/summarycomment/structure/summary_comment_simplified_no_issues_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_entitled.md
diff --git a/testdata/messages/summarycomment/structure/summary_comment_simplified_no_issues_not_entitled.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_not_entitled.md
similarity index 97%
rename from testdata/messages/summarycomment/structure/summary_comment_simplified_no_issues_not_entitled.md
rename to testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_not_entitled.md
index 1007bec21..1fb274ee7 100644
--- a/testdata/messages/summarycomment/structure/summary_comment_simplified_no_issues_not_entitled.md
+++ b/testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_not_entitled.md
@@ -1,7 +1,10 @@
**👍 Frogbot scanned this pull request and found that it did not add vulnerable dependencies.**
+---
Note:
+---
+
---
**Frogbot** also supports **Contextual Analysis, Secret Detection, IaC and SAST Vulnerabilities Scanning**. This features are included as part of the [JFrog Advanced Security](https://jfrog.com/advanced-security) package, which isn't enabled on your system.
diff --git a/testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_not_entitled_with_title.md b/testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_not_entitled_with_title.md
new file mode 100644
index 000000000..a7eda5658
--- /dev/null
+++ b/testdata/messages/summarycomment/structure/summary_comment_no_issues_simplified_not_entitled_with_title.md
@@ -0,0 +1,17 @@
+**👍 Frogbot scanned this pull request and found that it did not add vulnerable dependencies.**
+
+---
+## **Custom title**
+
+---
+
+---
+Note:
+
+---
+
+---
+**Frogbot** also supports **Contextual Analysis, Secret Detection, IaC and SAST Vulnerabilities Scanning**. This features are included as part of the [JFrog Advanced Security](https://jfrog.com/advanced-security) package, which isn't enabled on your system.
+
+---
+[🐸 JFrog Frogbot](https://github.com/jfrog/frogbot#readme)
\ No newline at end of file
diff --git a/utils/outputwriter/outputcontent.go b/utils/outputwriter/outputcontent.go
index 7ea7cc349..297aca27c 100644
--- a/utils/outputwriter/outputcontent.go
+++ b/utils/outputwriter/outputcontent.go
@@ -31,7 +31,7 @@ func GetPRSummaryContent(content string, issuesExists, isComment bool, writer Ou
comment.WriteString(writer.Image(getPRSummaryBanner(issuesExists, isComment, writer.VcsProvider())))
customCommentTitle := writer.PullRequestCommentTitle()
if customCommentTitle != "" {
- comment.WriteString(customCommentTitle)
+ WriteContent(&comment, writer.MarkAsTitle(MarkAsBold(customCommentTitle), 2))
}
if issuesExists {
WriteContent(&comment, content)
@@ -84,7 +84,7 @@ func untitledForJasMsg(writer OutputWriter) string {
if writer.AvoidExtraMessages() || writer.IsEntitledForJas() {
return ""
}
- return writer.MarkAsCollapsible("Note", fmt.Sprintf("%s\n%s", SectionDivider(), writer.MarkInCenter(jasFeaturesMsgWhenNotEnabled)))
+ return writer.MarkAsDetails("Note:", 0, fmt.Sprintf("%s\n%s", SectionDivider(), writer.MarkInCenter(jasFeaturesMsgWhenNotEnabled)))
}
func footer(writer OutputWriter) string {
diff --git a/utils/outputwriter/outputcontent_test.go b/utils/outputwriter/outputcontent_test.go
index c722134a2..eedaa0072 100644
--- a/utils/outputwriter/outputcontent_test.go
+++ b/utils/outputwriter/outputcontent_test.go
@@ -182,7 +182,6 @@ func TestGetPRSummaryContent(t *testing.T) {
cases []OutputTestCase
issuesExists bool
isComment bool
- addPullRequestCommentTitle bool
}{
{
name: "Summary comment No issues found",
@@ -192,32 +191,47 @@ func TestGetPRSummaryContent(t *testing.T) {
{
name: "Pull Request not entitled (Standard output)",
writer: &StandardOutput{},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_pr_no_issues_not_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_pr_not_entitled.md"),
},
{
name: "Pull Request entitled (Standard output)",
writer: &StandardOutput{MarkdownOutput{entitledForJas: true}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_pr_no_issues_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_pr_entitled.md"),
},
{
name: "Merge Request not entitled (Standard output)",
writer: &StandardOutput{MarkdownOutput{vcsProvider: vcsutils.GitLab}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_mr_no_issues_not_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_mr_not_entitled.md"),
},
{
name: "Merge Request entitled (Standard output)",
writer: &StandardOutput{MarkdownOutput{vcsProvider: vcsutils.GitLab, entitledForJas: true}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_mr_no_issues_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_mr_entitled.md"),
},
{
name: "Simplified output not entitled",
writer: &SimplifiedOutput{},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_simplified_no_issues_not_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_simplified_not_entitled.md"),
},
{
name: "Simplified output entitled",
writer: &SimplifiedOutput{MarkdownOutput{entitledForJas: true}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_simplified_no_issues_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_simplified_entitled.md"),
+ },
+ {
+ name: "Pull request not entitled custom title (Standard output)",
+ writer: &StandardOutput{MarkdownOutput{pullRequestCommentTitle: "Custom title"}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_pr_not_entitled_with_title.md"),
+ },
+ {
+ name: "Pull request not entitled custom title (Simplified output)",
+ writer: &SimplifiedOutput{MarkdownOutput{pullRequestCommentTitle: "Custom title"}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_simplified_not_entitled_with_title.md"),
+ },
+ {
+ name: "Merge Request not entitled avoid extra messages (Standard output)",
+ writer: &StandardOutput{MarkdownOutput{avoidExtraMessages: true, vcsProvider: vcsutils.GitLab}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_no_issues_mr_entitled.md"),
},
},
},
@@ -229,55 +243,57 @@ func TestGetPRSummaryContent(t *testing.T) {
{
name: "Pull Request not entitled (Standard output)",
writer: &StandardOutput{},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_pr_issues_not_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_pr_not_entitled.md"),
},
{
name: "Pull Request entitled (Standard output)",
writer: &StandardOutput{MarkdownOutput{entitledForJas: true}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_pr_issues_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_pr_entitled.md"),
},
{
name: "Merge Request not entitled (Standard output)",
writer: &StandardOutput{MarkdownOutput{vcsProvider: vcsutils.GitLab}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_mr_issues_not_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_mr_not_entitled.md"),
},
{
name: "Merge Request entitled (Standard output)",
writer: &StandardOutput{MarkdownOutput{vcsProvider: vcsutils.GitLab, entitledForJas: true}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_mr_issues_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_mr_entitled.md"),
},
{
name: "Simplified output not entitled",
writer: &SimplifiedOutput{},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_simplified_issues_not_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_simplified_not_entitled.md"),
+ },
+ {
+ name: "Pull Request not entitled avoid extra messages (Standard output)",
+ writer: &StandardOutput{MarkdownOutput{avoidExtraMessages: true}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_pr_entitled.md"),
+ },
+ {
+ name: "Simplified output not entitled avoid extra messages",
+ writer: &SimplifiedOutput{MarkdownOutput{avoidExtraMessages: true}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_simplified_entitled.md"),
},
{
name: "Simplified output entitled",
writer: &SimplifiedOutput{MarkdownOutput{entitledForJas: true}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_simplified_issues_entitled.md"),
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_simplified_entitled.md"),
},
- },
- },
- {
- name: "Summary comments with issues with pull request title",
- issuesExists: true,
- isComment: true,
- addPullRequestCommentTitle: true,
- cases: []OutputTestCase{
{
- name: "Merge Request entitled (Standard output)",
- writer: &StandardOutput{MarkdownOutput{entitledForJas: true, vcsProvider: vcsutils.GitLab}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_mr_issues_entitled_with_title.md"),
+ name: "Merge Request entitled custom title (Standard output)",
+ writer: &StandardOutput{MarkdownOutput{pullRequestCommentTitle: "Custom title", entitledForJas: true, vcsProvider: vcsutils.GitLab}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_mr_entitled_with_title.md"),
},
{
- name: "Pull Request not entitled (Standard output)",
- writer: &StandardOutput{},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_pr_issues_not_entitled_with_title.md"),
+ name: "Pull Request not entitled custom title (Standard output)",
+ writer: &StandardOutput{MarkdownOutput{pullRequestCommentTitle: "Custom title"}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_pr_not_entitled_with_title.md"),
},
{
- name: "Pull request entitled (Simplified output)",
- writer: &SimplifiedOutput{MarkdownOutput{entitledForJas: true}},
- expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_simplified_issues_entitled_with_title.md"),
+ name: "Pull request entitled custom title (Simplified output)",
+ writer: &SimplifiedOutput{MarkdownOutput{pullRequestCommentTitle: "Custom title", entitledForJas: true}},
+ expectedOutputPath: filepath.Join(testSummaryCommentDir, "structure", "summary_comment_issues_simplified_entitled_with_title.md"),
},
},
},
@@ -325,9 +341,6 @@ func TestGetPRSummaryContent(t *testing.T) {
for _, tc := range testCases {
for _, test := range tc.cases {
t.Run(tc.name+"_"+test.name, func(t *testing.T) {
- if tc.addPullRequestCommentTitle {
- test.writer.SetPullRequestCommentTitle("Test Build")
- }
expectedOutput := GetExpectedTestOutput(t, test)
output := GetPRSummaryContent(content, tc.issuesExists, tc.isComment, test.writer)
assert.Equal(t, expectedOutput, output)
@@ -879,11 +892,4 @@ func TestSastReviewContent(t *testing.T) {
})
}
}
-}
-
-func TestMarkAsCollapsible(t *testing.T) {
- so := &StandardOutput{}
- assert.Equal(t, "
\ntitle
\ndescription\n ", so.MarkAsCollapsible("title", "description"))
- smo := &SimplifiedOutput{}
- assert.Equal(t, "\ntitle:\ndescription", smo.MarkAsCollapsible("title", "description"))
-}
+}
\ No newline at end of file
diff --git a/utils/outputwriter/outputwriter.go b/utils/outputwriter/outputwriter.go
index 19cd43f21..2cb162b71 100644
--- a/utils/outputwriter/outputwriter.go
+++ b/utils/outputwriter/outputwriter.go
@@ -101,7 +101,6 @@ type OutputWriter interface {
// Markdown interface
FormattedSeverity(severity, applicability string) string
Separator() string
- MarkAsCollapsible(title, content string) string
MarkInCenter(content string) string
MarkAsDetails(summary string, subTitleDepth int, content string) string
MarkAsTitle(title string, subTitleDepth int) string
@@ -137,6 +136,10 @@ func (mo *MarkdownOutput) SetJasOutputFlags(entitled, showCaColumn bool) {
mo.showCaColumn = showCaColumn
}
+func (mo *MarkdownOutput) SetPullRequestCommentTitle(pullRequestCommentTitle string) {
+ mo.pullRequestCommentTitle = pullRequestCommentTitle
+}
+
func (mo *MarkdownOutput) IsShowingCaColumn() bool {
return mo.showCaColumn
}
@@ -145,6 +148,10 @@ func (mo *MarkdownOutput) IsEntitledForJas() bool {
return mo.entitledForJas
}
+func (mo *MarkdownOutput) PullRequestCommentTitle() string {
+ return mo.pullRequestCommentTitle
+}
+
func GetCompatibleOutputWriter(provider vcsutils.VcsProvider) OutputWriter {
switch provider {
case vcsutils.BitbucketServer:
diff --git a/utils/outputwriter/simplifiedoutput.go b/utils/outputwriter/simplifiedoutput.go
index e67d0c666..660f77a59 100644
--- a/utils/outputwriter/simplifiedoutput.go
+++ b/utils/outputwriter/simplifiedoutput.go
@@ -29,25 +29,13 @@ func (smo *SimplifiedOutput) MarkInCenter(content string) string {
return content
}
-func (smo *SimplifiedOutput) MarkAsCollapsible(title, content string) string {
- return fmt.Sprintf("\n%s:\n%s", title, content)
-}
-
func (smo *SimplifiedOutput) MarkAsDetails(summary string, subTitleDepth int, content string) string {
return fmt.Sprintf("%s\n%s", smo.MarkAsTitle(summary, subTitleDepth), content)
}
func (smo *SimplifiedOutput) MarkAsTitle(title string, subTitleDepth int) string {
- return fmt.Sprintf("%s\n%s %s\n%s", SectionDivider(), strings.Repeat("#", subTitleDepth), title, SectionDivider())
-}
-
-func (smo *SimplifiedOutput) SetPullRequestCommentTitle(pullRequestCommentTitle string) {
- smo.pullRequestCommentTitle = pullRequestCommentTitle
- if smo.pullRequestCommentTitle != "" {
- smo.pullRequestCommentTitle = "\n\n" + MarkAsBold(pullRequestCommentTitle)
+ if subTitleDepth == 0 {
+ return fmt.Sprintf("%s\n%s\n%s", SectionDivider(), title, SectionDivider())
}
-}
-
-func (smo *SimplifiedOutput) PullRequestCommentTitle() string {
- return smo.pullRequestCommentTitle
+ return fmt.Sprintf("%s\n%s %s\n%s", SectionDivider(), strings.Repeat("#", subTitleDepth), title, SectionDivider())
}
diff --git a/utils/outputwriter/standardoutput.go b/utils/outputwriter/standardoutput.go
index d353cb8eb..92f40c899 100644
--- a/utils/outputwriter/standardoutput.go
+++ b/utils/outputwriter/standardoutput.go
@@ -27,28 +27,19 @@ func (so *StandardOutput) MarkInCenter(content string) string {
func (so *StandardOutput) MarkAsDetails(summary string, subTitleDepth int, content string) string {
if summary != "" {
- summary = fmt.Sprintf("
%s \n
\n", summary)
+ summary = fmt.Sprintf("
%s \n", summary)
+ }
+ if subTitleDepth > 0 {
+ summary += "
\n"
}
return fmt.Sprintf("
\n%s\n%s\n\n \n", summary, content)
}
func (so *StandardOutput) MarkAsTitle(title string, subTitleDepth int) string {
- return fmt.Sprintf("%s %s", strings.Repeat("#", subTitleDepth), title)
-}
-
-func (so *StandardOutput) MarkAsCollapsible(title, content string) string {
- return fmt.Sprintf("
\n%s
\n%s\n ", title, content)
-}
-
-func (so *StandardOutput) SetPullRequestCommentTitle(pullRequestCommentTitle string) {
- so.pullRequestCommentTitle = pullRequestCommentTitle
- if so.pullRequestCommentTitle != "" {
- so.pullRequestCommentTitle = "\n" + so.MarkAsTitle(so.pullRequestCommentTitle, 2)
+ if subTitleDepth == 0 {
+ return title
}
-}
-
-func (so *StandardOutput) PullRequestCommentTitle() string {
- return so.pullRequestCommentTitle
+ return fmt.Sprintf("%s %s", strings.Repeat("#", subTitleDepth), title)
}
func GetMarkdownCenterTag(content string) string {