Skip to content

Commit

Permalink
Reduce visual noise in report
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksnyder committed Sep 16, 2020
1 parent 9a9d986 commit dc8b3fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ jobs:
It will post a comment on PRs to notify subscribers:
> # CODENOTIFY report
>
> a1b2c3...d4e5f6
> Notifying subscribers in [CODENOTIFY](https://github.com/sourcegraph/codenotify) files for diff a1b2c3...d4e5f6.
>
> | Notify | File(s) |
> | ------ | -------------------- |
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ type options struct {
print func(notifs map[string][]string) error
}

const markdownCommentTitle = "# CODENOTIFY report\n\n"
const markdownCommentTitle = "<!-- codenotify report -->\n"

func (o *options) writeNotifications(w io.Writer, notifs map[string][]string) error {
subs := []string{}
Expand All @@ -374,7 +374,7 @@ func (o *options) writeNotifications(w io.Writer, notifs map[string][]string) er
return nil
case "markdown":
fmt.Fprint(w, markdownCommentTitle)
fmt.Fprintf(w, "%s...%s\n\n", o.baseRef, o.headRef)
fmt.Fprintf(w, "Notifying subscribers in [CODENOTIFY](https://github.com/sourcegraph/codenotify) files for diff %s...%s.\n\n", o.baseRef, o.headRef)
if len(notifs) == 0 {
fmt.Fprintln(w, "No notifications.")
} else {
Expand Down
10 changes: 4 additions & 6 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,8 @@ func TestWriteNotifications(t *testing.T) {
},
notifs: nil,
output: []string{
"# CODENOTIFY report",
"",
"a...b",
"<!-- codenotify report -->",
"Notifying subscribers in [CODENOTIFY](https://github.com/sourcegraph/codenotify) files for diff a...b.",
"",
"No notifications.",
},
Expand Down Expand Up @@ -177,9 +176,8 @@ func TestWriteNotifications(t *testing.T) {
"@js": {"file.js", "dir/file.js"},
},
output: []string{
"# CODENOTIFY report",
"",
"a...b",
"<!-- codenotify report -->",
"Notifying subscribers in [CODENOTIFY](https://github.com/sourcegraph/codenotify) files for diff a...b.",
"",
"| Notify | File(s) |",
"|-|-|",
Expand Down

0 comments on commit dc8b3fb

Please sign in to comment.