You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by zh...@apache.org on 2022/08/24 02:38:55 UTC

[incubator-devlake] branch main updated: fix: to fix issue2786 (#2813)

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

zhangliang2022 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 86fbbcfd fix: to fix issue2786 (#2813)
86fbbcfd is described below

commit 86fbbcfd020491e15cfa3a9d88c23cc8cd110049
Author: tsoc <47...@users.noreply.github.com>
AuthorDate: Wed Aug 24 10:38:51 2022 +0800

    fix: to fix issue2786 (#2813)
---
 plugins/gitee/tasks/api_client.go          | 10 ++++++++++
 plugins/gitee/tasks/pr_commit_collector.go |  1 +
 2 files changed, 11 insertions(+)

diff --git a/plugins/gitee/tasks/api_client.go b/plugins/gitee/tasks/api_client.go
index 8449437a..6594953e 100644
--- a/plugins/gitee/tasks/api_client.go
+++ b/plugins/gitee/tasks/api_client.go
@@ -68,3 +68,13 @@ func NewGiteeApiClient(taskCtx core.TaskContext, connection *models.GiteeConnect
 	}
 	return asyncApiClient, nil
 }
+
+func ignoreHTTPStatus404(res *http.Response) error {
+	if res.StatusCode == http.StatusUnauthorized {
+		return fmt.Errorf("authentication failed, please check your AccessToken")
+	}
+	if res.StatusCode == http.StatusNotFound {
+		return helper.ErrIgnoreAndContinue
+	}
+	return nil
+}
diff --git a/plugins/gitee/tasks/pr_commit_collector.go b/plugins/gitee/tasks/pr_commit_collector.go
index b6dde388..8ba15621 100644
--- a/plugins/gitee/tasks/pr_commit_collector.go
+++ b/plugins/gitee/tasks/pr_commit_collector.go
@@ -91,6 +91,7 @@ func CollectApiPullRequestCommits(taskCtx core.SubTaskContext) error {
 			}
 			return items, nil
 		},
+		AfterResponse: ignoreHTTPStatus404,
 	})
 
 	if err != nil {