This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v1.0
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v1.0 by this push:
new 7e3053f0f fix: pr commit 404 (#7577) (#7582)
7e3053f0f is described below
commit 7e3053f0f921e5d51672fcba1f7adfb68af92338
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jun 6 15:02:09 2024 +0800
fix: pr commit 404 (#7577) (#7582)
Co-authored-by: abeizn <[email protected]>
---
.../plugins/bitbucket_server/tasks/pr_commit_collector.go | 1 +
backend/plugins/bitbucket_server/tasks/task_data.go | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/backend/plugins/bitbucket_server/tasks/pr_commit_collector.go
b/backend/plugins/bitbucket_server/tasks/pr_commit_collector.go
index 1fd69f024..dabf58823 100644
--- a/backend/plugins/bitbucket_server/tasks/pr_commit_collector.go
+++ b/backend/plugins/bitbucket_server/tasks/pr_commit_collector.go
@@ -57,6 +57,7 @@ func CollectApiPullRequestCommits(taskCtx
plugin.SubTaskContext) errors.Error {
Input: iterator,
UrlTemplate: "rest/api/1.0/projects/{{
.Params.FullName }}/pull-requests/{{ .Input.BitbucketId }}/commits",
ResponseParser: GetRawMessageFromResponse,
+ AfterResponse: ignoreHTTPStatus404,
})
if err != nil {
return err
diff --git a/backend/plugins/bitbucket_server/tasks/task_data.go
b/backend/plugins/bitbucket_server/tasks/task_data.go
index 45d6c9858..dd2571e79 100644
--- a/backend/plugins/bitbucket_server/tasks/task_data.go
+++ b/backend/plugins/bitbucket_server/tasks/task_data.go
@@ -18,6 +18,8 @@ limitations under the License.
package tasks
import (
+ "net/http"
+
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/bitbucket_server/models"
@@ -77,3 +79,13 @@ func ValidateTaskOptions(op *BitbucketServerOptions)
errors.Error {
}
return nil
}
+
+func ignoreHTTPStatus404(res *http.Response) errors.Error {
+ if res.StatusCode == http.StatusUnauthorized {
+ return errors.Unauthorized.New("authentication failed, please
check your AccessToken")
+ }
+ if res.StatusCode == http.StatusNotFound {
+ return api.ErrIgnoreAndContinue
+ }
+ return nil
+}