Skip to content

Commit dcc1310

Browse files
authored
Exclude pull request author (#10)
1 parent 8b89374 commit dcc1310

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Install the [Codenotify](https://github.com/apps/codenotify) GitHub App on your
2727
- [Go](https://golang.org/doc/install) (v1.19 or higher)
2828
- [Task](https://github.com/go-task/task) (v3)
2929
- [ngrok](https://ngrok.com/)
30-
- [Codenotify](https://github.com/sourcegraph/codenotify) (v0.6.3 or higher)
30+
- [Codenotify](https://github.com/sourcegraph/codenotify) (v0.6.4 or higher)
3131

3232
#### macOS
3333

@@ -36,7 +36,7 @@ Install the [Codenotify](https://github.com/apps/codenotify) GitHub App on your
3636

3737
```bash
3838
brew install git go go-task/tap/go-task ngrok
39-
go install https://github.com/sourcegraph/codenotify@latest
39+
go install https://github.com/sourcegraph/codenotify@v0.6.4
4040

4141
# In the root directory of the repository
4242
ln -s $(go env GOPATH)/bin/codenotify $(pwd)/.bin/codenotify

cli.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,15 @@ func checkout(ctx context.Context, w io.Writer, repoPath, remoteURL, headCommit
7171
return nil
7272
}
7373

74-
func codenotify(ctx context.Context, w io.Writer, binPath, repoPath, baseRef, headRef string) (string, error) {
74+
func codenotify(ctx context.Context, w io.Writer, binPath, repoPath, baseRef, headRef, author string) (string, error) {
7575
output, err := run(
7676
ctx,
7777
w,
7878
binPath,
7979
"--cwd", repoPath,
8080
"--baseRef", baseRef,
8181
"--headRef", headRef,
82+
"--author", "@"+author,
8283
"--format=markdown",
8384
"--filename=CODENOTIFY",
8485
"--subscriber-threshold=10",

github.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func logPathByRunID(rootDir, runID string) string {
106106

107107
func checkoutAndRun(ctx context.Context, config *conf.Config, payload *github.PullRequestEvent, token string) (output string, runID string, err error) {
108108
tmpPath := fmt.Sprintf("tmp/repos/%s-%d", *payload.PullRequest.NodeID, time.Now().Unix())
109-
err = os.MkdirAll(path.Dir(tmpPath), os.ModeDir)
109+
err = os.MkdirAll(path.Dir(tmpPath), os.ModePerm)
110110
if err != nil {
111111
return "", "", errors.Wrap(err, "create temp directory")
112112
}
@@ -147,7 +147,15 @@ func checkoutAndRun(ctx context.Context, config *conf.Config, payload *github.Pu
147147
return "", id.String(), errors.Wrap(err, "checkout pull request")
148148
}
149149

150-
output, err = codenotify(ctx, &buf, config.Codenotify.BinPath, tmpPath, *payload.PullRequest.Base.SHA, *payload.PullRequest.Head.SHA)
150+
output, err = codenotify(
151+
ctx,
152+
&buf,
153+
config.Codenotify.BinPath,
154+
tmpPath,
155+
*payload.PullRequest.Base.SHA,
156+
*payload.PullRequest.Head.SHA,
157+
*payload.PullRequest.User.Login,
158+
)
151159
if err != nil {
152160
return "", id.String(), errors.Wrap(err, "run Codenotify")
153161
}

0 commit comments

Comments
 (0)