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

abeizn 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 e84f28d84 fix(github): add regex enricher for deployment in graphql 
(#5012)
e84f28d84 is described below

commit e84f28d8456ecc9fcbd11d66ce4bd8ba7c71567e
Author: Warren Chen <[email protected]>
AuthorDate: Sun Apr 23 21:50:14 2023 +0800

    fix(github): add regex enricher for deployment in graphql (#5012)
---
 backend/plugins/github_graphql/impl/impl.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/backend/plugins/github_graphql/impl/impl.go 
b/backend/plugins/github_graphql/impl/impl.go
index 1602a0514..5d4466378 100644
--- a/backend/plugins/github_graphql/impl/impl.go
+++ b/backend/plugins/github_graphql/impl/impl.go
@@ -20,6 +20,7 @@ package impl
 import (
        "context"
        "fmt"
+       "github.com/apache/incubator-devlake/core/models/domainlayer/devops"
        "net/url"
        "reflect"
        "strings"
@@ -185,10 +186,19 @@ func (p GithubGraphql) PrepareTaskData(taskCtx 
plugin.TaskContext, options map[s
                return 
int(v.Elem().FieldByName(`RateLimit`).FieldByName(`Cost`).Int())
        })
 
+       regexEnricher := helper.NewRegexEnricher()
+       if err = regexEnricher.TryAdd(devops.DEPLOYMENT, op.DeploymentPattern); 
err != nil {
+               return nil, errors.BadInput.Wrap(err, "invalid value for 
`deploymentPattern`")
+       }
+       if err = regexEnricher.TryAdd(devops.PRODUCTION, op.ProductionPattern); 
err != nil {
+               return nil, errors.BadInput.Wrap(err, "invalid value for 
`productionPattern`")
+       }
+
        taskData := &githubTasks.GithubTaskData{
                Options:       &op,
                ApiClient:     apiClient,
                GraphqlClient: graphqlClient,
+               RegexEnricher: regexEnricher,
        }
        if op.TimeAfter != "" {
                var timeAfter time.Time

Reply via email to