Skip to content

Commit

Permalink
Merge pull request #4 from CarlJi/github_app
Browse files Browse the repository at this point in the history
chore: fix logs
  • Loading branch information
CarlJi authored Dec 28, 2023
2 parents 9e40f43 + 1f4f0f9 commit a14a208
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions hunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"

"github.com/google/go-github/v57/github"
"github.com/qiniu/x/log"
)

type HunkChecker interface {
Expand Down Expand Up @@ -33,9 +34,10 @@ func NewGithubCommitFileHunkChecker(commitFiles []*github.CommitFile) (*GithubCo
return nil, err
}

_, ok := hunks[commitFile.GetFilename()]
v, ok := hunks[commitFile.GetFilename()]
if ok {
return nil, fmt.Errorf("duplicate commitFile: %v", commitFile)
log.Warnf("duplicate commitFiles: %v, %v", commitFile, v)
continue
}

hunks[commitFile.GetFilename()] = fileHunks
Expand Down
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}

func (s *Server) processPullRequestEvent(log *xlog.Logger, event *github.PullRequestEvent, eventGUID string) error {
// TODO: synchonization 是什么意思?
// TODO: synchronization 是什么意思?
if event.GetAction() != "opened" && event.GetAction() != "reopened" {
log.Debugf("skipping action %s\n", event.GetAction())
return nil
Expand Down Expand Up @@ -117,7 +117,7 @@ func (s *Server) handle(log *xlog.Logger, ctx context.Context, event *github.Pul
log.Errorf("failed to build pull request comment body: %v", err)
return err
}
log.Infof("%s found valid %d comments related to this PR \n", name, len(comments))
log.Infof("%s found valid %d comments related to this PR %d (%s) \n", name, len(comments), num, org+"/"+repo)
totalComments = append(totalComments, comments...)
}

Expand Down

0 comments on commit a14a208

Please sign in to comment.