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

warren 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 fc2341fd7 fix: add refdiff; change typo in model (#3824)
fc2341fd7 is described below

commit fc2341fd7771eafd1df8dd31b947ad7705a147a3
Author: Likyh <[email protected]>
AuthorDate: Wed Nov 30 20:46:25 2022 +0800

    fix: add refdiff; change typo in model (#3824)
    
    * fix: add refdiff; change typo in model
    
    * fix: change column name
---
 plugins/github/api/blueprint_V200_test.go                     | 11 ++++-------
 plugins/github/api/blueprint_v200.go                          |  4 ++--
 .../models/migrationscripts/archived/transformation_rules.go  |  2 +-
 plugins/github/models/transformation_rule.go                  |  2 +-
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/plugins/github/api/blueprint_V200_test.go 
b/plugins/github/api/blueprint_V200_test.go
index ad0f67a3d..2798599fd 100644
--- a/plugins/github/api/blueprint_V200_test.go
+++ b/plugins/github/api/blueprint_V200_test.go
@@ -92,12 +92,8 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
                        Model: common.Model{
                                ID: 1,
                        },
-                       PrType: "hey,man,wasup",
-                       ReffdiffRule: json.RawMessage(`{
-                "tagsPattern": "pattern",
-                "tagsLimit": 10,
-                "tagsOrder": "reverse semver"
-              }`),
+                       PrType:  "hey,man,wasup",
+                       Refdiff: json.RawMessage(`{"tagsPattern": "pattern", 
"tagsLimit": 10, "tagsOrder": "reverse semver"}`),
                }
 
                var scope []core.Scope
@@ -116,7 +112,8 @@ func TestMakeDataSourcePipelinePlanV200(t *testing.T) {
                                        "owner":        "test",
                                        "repo":         "testRepo",
                                        "transformationRules": 
map[string]interface{}{
-                                               "prType": "hey,man,wasup",
+                                               "prType":  "hey,man,wasup",
+                                               "refdiff": 
json.RawMessage(`{"tagsPattern": "pattern", "tagsLimit": 10, "tagsOrder": 
"reverse semver"}`),
                                        },
                                },
                        },
diff --git a/plugins/github/api/blueprint_v200.go 
b/plugins/github/api/blueprint_v200.go
index fdc320d0d..31a6deb45 100644
--- a/plugins/github/api/blueprint_v200.go
+++ b/plugins/github/api/blueprint_v200.go
@@ -112,14 +112,14 @@ func makeDataSourcePipelinePlanV200(
        var repo *tasks.GithubApiRepo
        scopes := make([]core.Scope, 0)
        // refdiff
-       if transformationRule != nil && transformationRule.ReffdiffRule != nil {
+       if transformationRule != nil && transformationRule.Refdiff != nil {
                // add a new task to next stage
                j := i + 1
                if j == len(plan) {
                        plan = append(plan, nil)
                }
                refdiffOp := map[string]interface{}{}
-               err = 
errors.Convert(json.Unmarshal(transformationRule.ReffdiffRule, &refdiffOp))
+               err = errors.Convert(json.Unmarshal(transformationRule.Refdiff, 
&refdiffOp))
                if err != nil {
                        return nil, nil, err
                }
diff --git 
a/plugins/github/models/migrationscripts/archived/transformation_rules.go 
b/plugins/github/models/migrationscripts/archived/transformation_rules.go
index 52a6a0a1b..e6f12875b 100644
--- a/plugins/github/models/migrationscripts/archived/transformation_rules.go
+++ b/plugins/github/models/migrationscripts/archived/transformation_rules.go
@@ -35,7 +35,7 @@ type TransformationRules struct {
        IssueTypeIncident    string          `mapstructure:"issueTypeIncident" 
json:"issueTypeIncident" gorm:"type:varchar(255)"`
        IssueTypeRequirement string          
`mapstructure:"issueTypeRequirement" json:"issueTypeRequirement" 
gorm:"type:varchar(255)"`
        DeploymentPattern    string          `mapstructure:"deploymentPattern" 
json:"deploymentPattern" gorm:"type:varchar(255)"`
-       RefdiffRule          json.RawMessage `mapstructure:"refdiffRule" 
json:"refdiffRule"`
+       Refdiff              json.RawMessage `mapstructure:"refdiffRule" 
json:"refdiffRule"`
 }
 
 func (TransformationRules) TableName() string {
diff --git a/plugins/github/models/transformation_rule.go 
b/plugins/github/models/transformation_rule.go
index 16af8bb80..c218e4a66 100644
--- a/plugins/github/models/transformation_rule.go
+++ b/plugins/github/models/transformation_rule.go
@@ -35,7 +35,7 @@ type TransformationRules struct {
        IssueTypeIncident    string          
`mapstructure:"issueTypeIncident,omitempty" json:"issueTypeIncident" 
gorm:"type:varchar(255)"`
        IssueTypeRequirement string          
`mapstructure:"issueTypeRequirement,omitempty" json:"issueTypeRequirement" 
gorm:"type:varchar(255)"`
        DeploymentPattern    string          
`mapstructure:"deploymentPattern,omitempty" json:"deploymentPattern" 
gorm:"type:varchar(255)"`
-       ReffdiffRule         json.RawMessage `mapstructure:"-" json:"refdiff"`
+       Refdiff              json.RawMessage `mapstructure:"refdiff,omitempty" 
json:"refdiff"`
 }
 
 func (TransformationRules) TableName() string {

Reply via email to