Skip to content

Commit

Permalink
Use same ctx variable. (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
nishkrishnan authored Jul 27, 2022
1 parent 98c285a commit 025d57a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/vcs/provider/github/request/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ func (h *Handler) handleGithubCommentEvent(ctx context.Context, event *github.Is
if err != nil {
return &errors.EventParsingError{Err: err}
}
ctxWithRepo := context.WithValue(ctx, logging.RepositoryKey, commentEvent.BaseRepo.FullName)
ctxWithPull := context.WithValue(ctxWithRepo, logging.PullNumKey, commentEvent.PullNum)
ctxWithSha := context.WithValue(ctxWithPull, logging.SHAKey, commentEvent.Pull.HeadCommit)
ctx = context.WithValue(ctx, logging.RepositoryKey, commentEvent.BaseRepo.FullName)
ctx = context.WithValue(ctx, logging.PullNumKey, commentEvent.PullNum)
ctx = context.WithValue(ctx, logging.SHAKey, commentEvent.Pull.HeadCommit)

return h.commentHandler.Handle(ctxWithSha, request, commentEvent)
return h.commentHandler.Handle(ctx, request, commentEvent)
}

func (h *Handler) handleGithubPullRequestEvent(ctx context.Context, event *github.PullRequestEvent, request *http.BufferedRequest) error {
Expand All @@ -159,9 +159,9 @@ func (h *Handler) handleGithubPullRequestEvent(ctx context.Context, event *githu
if err != nil {
return &errors.EventParsingError{Err: err}
}
ctxWithRepo := context.WithValue(ctx, logging.RepositoryKey, pullEvent.Pull.BaseRepo.FullName)
ctxWithPull := context.WithValue(ctxWithRepo, logging.PullNumKey, pullEvent.Pull.Num)
ctxWithSha := context.WithValue(ctxWithPull, logging.SHAKey, pullEvent.Pull.HeadCommit)
ctx = context.WithValue(ctx, logging.RepositoryKey, pullEvent.Pull.BaseRepo.FullName)
ctx = context.WithValue(ctx, logging.PullNumKey, pullEvent.Pull.Num)
ctx = context.WithValue(ctx, logging.SHAKey, pullEvent.Pull.HeadCommit)

return h.prHandler.Handle(ctxWithSha, request, pullEvent)
return h.prHandler.Handle(ctx, request, pullEvent)
}

0 comments on commit 025d57a

Please sign in to comment.