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

abeizn pushed a commit to branch github-graphql-split
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/github-graphql-split by this 
push:
     new 3e138d95c fix: some detail
3e138d95c is described below

commit 3e138d95c3e2f402a269cfcab5b3e72802785a9b
Author: abeizn <[email protected]>
AuthorDate: Thu Dec 7 10:43:23 2023 +0800

    fix: some detail
---
 backend/plugins/github_graphql/tasks/account_extractor.go   |  6 +++---
 .../plugins/github_graphql/tasks/deployment_collector.go    | 13 +++----------
 backend/plugins/github_graphql/tasks/job_extractor.go       |  8 ++++----
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/backend/plugins/github_graphql/tasks/account_extractor.go 
b/backend/plugins/github_graphql/tasks/account_extractor.go
index 6c586bbba..a4fff15ba 100644
--- a/backend/plugins/github_graphql/tasks/account_extractor.go
+++ b/backend/plugins/github_graphql/tasks/account_extractor.go
@@ -55,15 +55,15 @@ func ExtractAccounts(taskCtx plugin.SubTaskContext) 
errors.Error {
                                return nil, err
                        }
                        accounts := apiAccount.Users
-                       results := make([]interface{}, 0, 1)
+                       var result []interface{}
                        for _, account := range accounts {
                                relatedUsers, err := convertAccount(account, 
data.Options.ConnectionId)
                                if err != nil {
                                        return nil, err
                                }
-                               results = append(results, relatedUsers...)
+                               result = append(result, relatedUsers...)
                        }
-                       return results, nil
+                       return result, nil
                },
        })
 
diff --git a/backend/plugins/github_graphql/tasks/deployment_collector.go 
b/backend/plugins/github_graphql/tasks/deployment_collector.go
index 488ec39d3..fbd687d49 100644
--- a/backend/plugins/github_graphql/tasks/deployment_collector.go
+++ b/backend/plugins/github_graphql/tasks/deployment_collector.go
@@ -38,7 +38,7 @@ var CollectDeploymentsMeta = plugin.SubTaskMeta{
        Name:             "CollectDeployments",
        EntryPoint:       CollectDeployments,
        EnabledByDefault: true,
-       Description:      "collect and extract github deployments to raw and 
tool layer from GithubGraphql api",
+       Description:      "collect github deployments to raw and tool layer 
from GithubGraphql api",
        DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD},
 }
 
@@ -83,8 +83,7 @@ type GraphqlQueryDeploymentDeployment struct {
        UpdatedAt time.Time
 }
 
-// CollectDeployments will request github api via graphql and store the result 
into raw layer by default
-// ResponseParser's return will be stored to tool layer. So it's called 
CollectorAndExtractor.
+// CollectDeployments will request github api via graphql and store the result 
into raw layer.
 func CollectDeployments(taskCtx plugin.SubTaskContext) errors.Error {
        data := taskCtx.GetData().(*githubTasks.GithubTaskData)
        collectorWithState, err := 
helper.NewStatefulApiCollector(helper.RawDataSubTaskArgs{
@@ -124,18 +123,12 @@ func CollectDeployments(taskCtx plugin.SubTaskContext) 
errors.Error {
                ResponseParser: func(iQuery interface{}, variables 
map[string]interface{}) ([]interface{}, error) {
                        query := iQuery.(*GraphqlQueryDeploymentWrapper)
                        deployments := query.Repository.Deployments.Deployments
-                       isFinish := false
                        for _, rawL := range deployments {
                                if collectorWithState.Since != nil && 
!collectorWithState.Since.Before(rawL.UpdatedAt) {
-                                       isFinish = true
                                        break
                                }
                        }
-                       if isFinish {
-                               return nil, helper.ErrFinishCollect
-                       } else {
-                               return nil, nil
-                       }
+                       return nil, nil
                },
        })
        if err != nil {
diff --git a/backend/plugins/github_graphql/tasks/job_extractor.go 
b/backend/plugins/github_graphql/tasks/job_extractor.go
index 73a4c486c..f5ce0dcec 100644
--- a/backend/plugins/github_graphql/tasks/job_extractor.go
+++ b/backend/plugins/github_graphql/tasks/job_extractor.go
@@ -85,10 +85,10 @@ func ExtractJobs(taskCtx plugin.SubTaskContext) 
errors.Error {
                                                //HeadSha:       ``,  // use 
_tool_github_runs
                                                //RunURL:        ``,
                                                //CheckRunURL:   ``,
-                                               //Labels:        ``, // not on 
use
-                                               //RunnerID:      ``, // not on 
use
-                                               //RunnerName:    ``, // not on 
use
-                                               //RunnerGroupID: ``, // not on 
use
+                                               //Labels:        ``, // not in 
use
+                                               //RunnerID:      ``, // not in 
use
+                                               //RunnerName:    ``, // not in 
use
+                                               //RunnerGroupID: ``, // not in 
use
                                        }
                                        results = append(results, githubJob)
                                }

Reply via email to