This is an automated email from the ASF dual-hosted git repository. klesh pushed a commit to branch kw-7852-components-field-length in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 731a1f52feca2db25de1b4f54fc8f2b6bc625553 Author: Klesh Wong <[email protected]> AuthorDate: Wed Aug 7 17:29:35 2024 +0800 refactor: update github deployment extractor to extract single records --- .../github_graphql/tasks/deployment_extractor.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/backend/plugins/github_graphql/tasks/deployment_extractor.go b/backend/plugins/github_graphql/tasks/deployment_extractor.go index 1eb6c252b..78a96ca76 100644 --- a/backend/plugins/github_graphql/tasks/deployment_extractor.go +++ b/backend/plugins/github_graphql/tasks/deployment_extractor.go @@ -51,21 +51,18 @@ func ExtractDeployments(taskCtx plugin.SubTaskContext) errors.Error { Table: RAW_DEPLOYMENT, }, Extract: func(row *api.RawData) ([]interface{}, errors.Error) { - apiDeployment := &GraphqlQueryDeploymentWrapper{} - err := errors.Convert(json.Unmarshal(row.Data, apiDeployment)) + deployment := &GraphqlQueryDeploymentDeployment{} + err := errors.Convert(json.Unmarshal(row.Data, deployment)) if err != nil { return nil, err } - deployments := apiDeployment.Repository.Deployments.Deployments var results []interface{} - for _, deployment := range deployments { - githubDeployment, err := convertGithubDeployment(deployment, data.Options.ConnectionId, data.Options.GithubId) - if err != nil { - return nil, errors.Convert(err) - } - results = append(results, githubDeployment) + githubDeployment, err := convertGithubDeployment(deployment, data.Options.ConnectionId, data.Options.GithubId) + if err != nil { + return nil, errors.Convert(err) } + results = append(results, githubDeployment) return results, nil }, @@ -76,7 +73,7 @@ func ExtractDeployments(taskCtx plugin.SubTaskContext) errors.Error { return extractor.Execute() } -func convertGithubDeployment(deployment GraphqlQueryDeploymentDeployment, connectionId uint64, githubId int) (*githubModels.GithubDeployment, error) { +func convertGithubDeployment(deployment *GraphqlQueryDeploymentDeployment, connectionId uint64, githubId int) (*githubModels.GithubDeployment, errors.Error) { ret := &githubModels.GithubDeployment{ ConnectionId: connectionId, GithubId: githubId,
