This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new d87e3d098 fix: the github issue of getting 502/403 error (#5879)
d87e3d098 is described below

commit d87e3d098068013e3e777f4f60f7f364846c99c3
Author: abeizn <[email protected]>
AuthorDate: Tue Aug 15 18:12:32 2023 +0800

    fix: the github issue of getting 502/403 error (#5879)
---
 backend/plugins/github/tasks/pr_review_comment_collector.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/backend/plugins/github/tasks/pr_review_comment_collector.go 
b/backend/plugins/github/tasks/pr_review_comment_collector.go
index a2c817221..48661a335 100644
--- a/backend/plugins/github/tasks/pr_review_comment_collector.go
+++ b/backend/plugins/github/tasks/pr_review_comment_collector.go
@@ -66,6 +66,12 @@ func CollectPrReviewComments(taskCtx plugin.SubTaskContext) 
errors.Error {
                ApiClient:   data.ApiClient,
                PageSize:    100,
                Incremental: incremental,
+               Header: func(reqData *helper.RequestData) (http.Header, 
errors.Error) {
+                       // Adding -H "Accept: application/vnd.github+json" 
solve the issue of getting 502/403 error
+                       header := http.Header{}
+                       header.Set("Accept", "application/vnd.github+json")
+                       return header, nil
+               },
 
                UrlTemplate: "repos/{{ .Params.Name }}/pulls/comments",
                Query: func(reqData *helper.RequestData) (url.Values, 
errors.Error) {

Reply via email to