Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix logs #4

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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