You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/11/25 01:19:11 UTC

[GitHub] [incubator-devlake] mindlesscloud opened a new pull request, #3803: feat: github support scope and transformation rule

mindlesscloud opened a new pull request, #3803:
URL: https://github.com/apache/incubator-devlake/pull/3803

   
   ### Summary
   1. add table `_tool_github_transformation_rules`
   2. add `transformation_rule_id` and `scope_id` to `_tool_github_repos`
   3. supply HTTP endpoints for the entities `transformation rules` and `GitHub repos`
   4. remove two subtasks  `collectApiRepo` and `extractApiRepo`
   
   ### Does this close any open issues?
   No, partially fulfilled issue #3468
   
   ### Screenshots
   ![image](https://user-images.githubusercontent.com/8455907/203881618-f98f363f-4513-4e91-bab5-f922de36c3ff.png)
   ![image](https://user-images.githubusercontent.com/8455907/203881634-51ee2c7f-1cbf-42f5-a0e9-0c9783870669.png)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mindlesscloud commented on a diff in pull request #3803: feat: github support scope and transformation rule

Posted by GitBox <gi...@apache.org>.
mindlesscloud commented on code in PR #3803:
URL: https://github.com/apache/incubator-devlake/pull/3803#discussion_r1034323119


##########
plugins/github/api/scope.go:
##########
@@ -0,0 +1,164 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"github.com/mitchellh/mapstructure"
+)
+
+// PutScope create or update github repo
+// @Summary create or update github repo
+// @Description Create or update github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PUT]
+func PutScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := errors.Convert(mapstructure.Decode(input.Body, &repo))
+	if err != nil {
+		return nil, errors.BadInput.Wrap(err, "decoding Github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().CreateOrUpdate(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// UpdateScope patch to github repo
+// @Summary patch to github repo
+// @Description patch to github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PATCH]
+func UpdateScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "getting GithubRepo error")
+	}
+	err = helper.DecodeMapStruct(input.Body, &repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "patch github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().Update(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// GetScopeList get Github repos
+// @Summary get Github repos
+// @Description get Github repos
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Success 200  {object} []models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/ [GET]
+func GetScopeList(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repos []models.GithubRepo
+	connectionId, _ := extractParam(input.Params)
+	if connectionId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().All(&repos, dal.Where("connection_id = ?", connectionId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repos, Status: http.StatusOK}, nil
+}
+
+// GetScope get one Github repo
+// @Summary get one Github repo
+// @Description get one Github repo
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [GET]
+func GetScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repo models.GithubRepo
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+func extractParam(params map[string]string) (uint64, uint64) {
+	connectionId, _ := strconv.ParseUint(params["connectionId"], 10, 64)
+	repoId, _ := strconv.ParseUint(params["repoId"], 10, 64)
+	return connectionId, repoId
+}
+
+func verifyRepo(repo *models.GithubRepo) errors.Error {
+	if repo.ConnectionId == 0 {

Review Comment:
   No, it's an unsigned integer



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3803: feat: github support scope and transformation rule

Posted by GitBox <gi...@apache.org>.
klesh commented on code in PR #3803:
URL: https://github.com/apache/incubator-devlake/pull/3803#discussion_r1034233573


##########
plugins/github/api/scope.go:
##########
@@ -0,0 +1,164 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"github.com/mitchellh/mapstructure"
+)
+
+// PutScope create or update github repo
+// @Summary create or update github repo
+// @Description Create or update github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PUT]
+func PutScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := errors.Convert(mapstructure.Decode(input.Body, &repo))
+	if err != nil {
+		return nil, errors.BadInput.Wrap(err, "decoding Github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().CreateOrUpdate(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// UpdateScope patch to github repo
+// @Summary patch to github repo
+// @Description patch to github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PATCH]
+func UpdateScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "getting GithubRepo error")
+	}
+	err = helper.DecodeMapStruct(input.Body, &repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "patch github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().Update(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// GetScopeList get Github repos
+// @Summary get Github repos
+// @Description get Github repos
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Success 200  {object} []models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/ [GET]
+func GetScopeList(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repos []models.GithubRepo
+	connectionId, _ := extractParam(input.Params)
+	if connectionId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().All(&repos, dal.Where("connection_id = ?", connectionId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repos, Status: http.StatusOK}, nil
+}
+
+// GetScope get one Github repo
+// @Summary get one Github repo
+// @Description get one Github repo
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [GET]
+func GetScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repo models.GithubRepo
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+func extractParam(params map[string]string) (uint64, uint64) {
+	connectionId, _ := strconv.ParseUint(params["connectionId"], 10, 64)
+	repoId, _ := strconv.ParseUint(params["repoId"], 10, 64)
+	return connectionId, repoId
+}
+
+func verifyRepo(repo *models.GithubRepo) errors.Error {
+	if repo.ConnectionId == 0 {

Review Comment:
   Could it be negative?



##########
plugins/github/api/scope.go:
##########
@@ -0,0 +1,164 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"github.com/mitchellh/mapstructure"
+)
+
+// PutScope create or update github repo
+// @Summary create or update github repo
+// @Description Create or update github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PUT]
+func PutScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := errors.Convert(mapstructure.Decode(input.Body, &repo))
+	if err != nil {
+		return nil, errors.BadInput.Wrap(err, "decoding Github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().CreateOrUpdate(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// UpdateScope patch to github repo
+// @Summary patch to github repo
+// @Description patch to github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PATCH]
+func UpdateScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "getting GithubRepo error")
+	}
+	err = helper.DecodeMapStruct(input.Body, &repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "patch github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().Update(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// GetScopeList get Github repos
+// @Summary get Github repos
+// @Description get Github repos
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Success 200  {object} []models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/ [GET]
+func GetScopeList(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {

Review Comment:
   the number of total scopes could be huge over time. we should add pagination to this API.



##########
plugins/github/api/scope.go:
##########
@@ -0,0 +1,164 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"github.com/mitchellh/mapstructure"
+)
+
+// PutScope create or update github repo
+// @Summary create or update github repo
+// @Description Create or update github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PUT]
+func PutScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := errors.Convert(mapstructure.Decode(input.Body, &repo))
+	if err != nil {
+		return nil, errors.BadInput.Wrap(err, "decoding Github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().CreateOrUpdate(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// UpdateScope patch to github repo
+// @Summary patch to github repo
+// @Description patch to github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PATCH]
+func UpdateScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "getting GithubRepo error")
+	}
+	err = helper.DecodeMapStruct(input.Body, &repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "patch github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().Update(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// GetScopeList get Github repos
+// @Summary get Github repos
+// @Description get Github repos
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Success 200  {object} []models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/ [GET]
+func GetScopeList(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repos []models.GithubRepo
+	connectionId, _ := extractParam(input.Params)
+	if connectionId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().All(&repos, dal.Where("connection_id = ?", connectionId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repos, Status: http.StatusOK}, nil
+}
+
+// GetScope get one Github repo
+// @Summary get one Github repo
+// @Description get one Github repo
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [GET]
+func GetScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repo models.GithubRepo
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+func extractParam(params map[string]string) (uint64, uint64) {
+	connectionId, _ := strconv.ParseUint(params["connectionId"], 10, 64)
+	repoId, _ := strconv.ParseUint(params["repoId"], 10, 64)
+	return connectionId, repoId
+}
+
+func verifyRepo(repo *models.GithubRepo) errors.Error {
+	if repo.ConnectionId == 0 {
+		return errors.BadInput.New("invalid connectionId")
+	}
+	if repo.GithubId == 0 {
+		return errors.BadInput.New("invalid repoId")
+	}
+	if repo.ScopeId != strconv.Itoa(repo.GithubId) {

Review Comment:
   Maybe we should rename `GithubId` to `ScopeId` instead?



##########
plugins/github/tasks/task_data.go:
##########
@@ -55,40 +56,43 @@ func DecodeAndValidateTaskOptions(options map[string]interface{}) (*GithubOption
 	if op.Repo == "" {
 		return nil, errors.BadInput.New("repo is required for GitHub execution")
 	}
-	if op.PrType == "" {
-		op.PrType = "type/(.*)$"
-	}
-	if op.PrComponent == "" {
-		op.PrComponent = "component/(.*)$"
-	}
-	if op.PrBodyClosePattern == "" {
-		op.PrBodyClosePattern = "(?mi)(fix|close|resolve|fixes|closes|resolves|fixed|closed|resolved)[\\s]*.*(((and )?(#|https:\\/\\/github.com\\/%s\\/%s\\/issues\\/)\\d+[ ]*)+)"
-	}
-	if op.IssueSeverity == "" {
-		op.IssueSeverity = "severity/(.*)$"
-	}
-	if op.IssuePriority == "" {
-		op.IssuePriority = "^(highest|high|medium|low)$"
-	}
-	if op.IssueComponent == "" {
-		op.IssueComponent = "component/(.*)$"
-	}
-	if op.IssueTypeBug == "" {
-		op.IssueTypeBug = "^(bug|failure|error)$"
-	}
-	if op.IssueTypeIncident == "" {
-		op.IssueTypeIncident = ""
-	}
-	if op.IssueTypeRequirement == "" {
-		op.IssueTypeRequirement = "^(feat|feature|proposal|requirement)$"
-	}
-	if op.DeploymentPattern == "" {
-		op.DeploymentPattern = "(?i)deploy"
-	}
-
 	// find the needed GitHub now
 	if op.ConnectionId == 0 {
 		return nil, errors.BadInput.New("connectionId is invalid")
 	}
+	if op.TransformationRules == nil && op.TransformationRuleId == 0 {

Review Comment:
   https://github.com/apache/incubator-devlake/issues/3150



##########
plugins/github/api/scope.go:
##########
@@ -0,0 +1,164 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"github.com/mitchellh/mapstructure"
+)
+
+// PutScope create or update github repo
+// @Summary create or update github repo
+// @Description Create or update github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PUT]
+func PutScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := errors.Convert(mapstructure.Decode(input.Body, &repo))
+	if err != nil {
+		return nil, errors.BadInput.Wrap(err, "decoding Github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().CreateOrUpdate(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// UpdateScope patch to github repo
+// @Summary patch to github repo
+// @Description patch to github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PATCH]
+func UpdateScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "getting GithubRepo error")
+	}
+	err = helper.DecodeMapStruct(input.Body, &repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "patch github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().Update(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// GetScopeList get Github repos
+// @Summary get Github repos
+// @Description get Github repos
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Success 200  {object} []models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/ [GET]
+func GetScopeList(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repos []models.GithubRepo
+	connectionId, _ := extractParam(input.Params)
+	if connectionId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().All(&repos, dal.Where("connection_id = ?", connectionId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repos, Status: http.StatusOK}, nil
+}
+
+// GetScope get one Github repo
+// @Summary get one Github repo
+// @Description get one Github repo
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [GET]
+func GetScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repo models.GithubRepo
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+func extractParam(params map[string]string) (uint64, uint64) {
+	connectionId, _ := strconv.ParseUint(params["connectionId"], 10, 64)
+	repoId, _ := strconv.ParseUint(params["repoId"], 10, 64)
+	return connectionId, repoId
+}
+
+func verifyRepo(repo *models.GithubRepo) errors.Error {
+	if repo.ConnectionId == 0 {
+		return errors.BadInput.New("invalid connectionId")
+	}
+	if repo.GithubId == 0 {
+		return errors.BadInput.New("invalid repoId")
+	}
+	if repo.ScopeId != strconv.Itoa(repo.GithubId) {

Review Comment:
   same as above



##########
plugins/github/api/transformation_rule.go:
##########
@@ -0,0 +1,125 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"github.com/mitchellh/mapstructure"
+)
+
+// CreateTransformationRule create transformation rule for Github
+// @Summary create transformation rule for Github
+// @Description create transformation rule for Github
+// @Tags plugins/github
+// @Accept application/json
+// @Param transformationRule body models.TransformationRules true "transformation rule"
+// @Success 200  {object} models.TransformationRules
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/transformation_rules [POST]
+func CreateTransformationRule(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var rule models.TransformationRules
+	err := mapstructure.Decode(input.Body, &rule)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error in decoding transformation rule")
+	}
+	err = basicRes.GetDal().Create(&rule)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving TransformationRule")
+	}
+	return &core.ApiResourceOutput{Body: rule, Status: http.StatusOK}, nil
+}
+
+// UpdateTransformationRule update transformation rule for Github
+// @Summary update transformation rule for Github
+// @Description update transformation rule for Github
+// @Tags plugins/github
+// @Accept application/json
+// @Param id path int true "id"
+// @Param transformationRule body models.TransformationRules true "transformation rule"
+// @Success 200  {object} models.TransformationRules
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/transformation_rules/{id} [PATCH]
+func UpdateTransformationRule(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	transformationRuleId, err := strconv.ParseUint(input.Params["id"], 10, 64)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "the transformation rule ID should be an integer")
+	}
+	var old models.TransformationRules
+	err = basicRes.GetDal().First(&old, dal.Where("id = ?", transformationRuleId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving TransformationRule")
+	}
+	err = helper.DecodeMapStruct(input.Body, &old)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error decoding map into transformationRule")
+	}
+	old.ID = transformationRuleId
+	err = basicRes.GetDal().Update(&old, dal.Where("id = ?", transformationRuleId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving TransformationRule")
+	}
+	return &core.ApiResourceOutput{Body: old, Status: http.StatusOK}, nil
+}
+
+// GetTransformationRule return one transformation rule
+// @Summary return one transformation rule
+// @Description return one transformation rule
+// @Tags plugins/github
+// @Param id path int true "id"
+// @Success 200  {object} models.TransformationRules
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/transformation_rules/{id} [GET]
+func GetTransformationRule(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	transformationRuleId, err := strconv.ParseUint(input.Params["id"], 10, 64)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "the transformation rule ID should be an integer")
+	}
+	var rule models.TransformationRules
+	err = basicRes.GetDal().First(&rule, dal.Where("id = ?", transformationRuleId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on get TransformationRule")
+	}
+	return &core.ApiResourceOutput{Body: rule, Status: http.StatusOK}, nil
+}
+
+// GetTransformationRuleList return all transformation rules
+// @Summary return all transformation rules
+// @Description return all transformation rules
+// @Tags plugins/github
+// @Success 200  {object} []models.TransformationRules
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/transformation_rules [GET]
+func GetTransformationRuleList(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {

Review Comment:
   pagination 



##########
plugins/github/api/scope.go:
##########
@@ -0,0 +1,164 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package api
+
+import (
+	"net/http"
+	"strconv"
+
+	"github.com/apache/incubator-devlake/errors"
+	"github.com/apache/incubator-devlake/plugins/core"
+	"github.com/apache/incubator-devlake/plugins/core/dal"
+	"github.com/apache/incubator-devlake/plugins/github/models"
+	"github.com/apache/incubator-devlake/plugins/helper"
+	"github.com/mitchellh/mapstructure"
+)
+
+// PutScope create or update github repo
+// @Summary create or update github repo
+// @Description Create or update github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PUT]
+func PutScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := errors.Convert(mapstructure.Decode(input.Body, &repo))
+	if err != nil {
+		return nil, errors.BadInput.Wrap(err, "decoding Github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().CreateOrUpdate(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// UpdateScope patch to github repo
+// @Summary patch to github repo
+// @Description patch to github repo
+// @Tags plugins/github
+// @Accept application/json
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Param scope body models.GithubRepo true "json"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [PATCH]
+func UpdateScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid connectionId or repoId")
+	}
+	var repo models.GithubRepo
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "getting GithubRepo error")
+	}
+	err = helper.DecodeMapStruct(input.Body, &repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "patch github repo error")
+	}
+	err = verifyRepo(&repo)
+	if err != nil {
+		return nil, err
+	}
+	err = basicRes.GetDal().Update(repo)
+	if err != nil {
+		return nil, errors.Default.Wrap(err, "error on saving GithubRepo")
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+// GetScopeList get Github repos
+// @Summary get Github repos
+// @Description get Github repos
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Success 200  {object} []models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/ [GET]
+func GetScopeList(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repos []models.GithubRepo
+	connectionId, _ := extractParam(input.Params)
+	if connectionId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().All(&repos, dal.Where("connection_id = ?", connectionId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repos, Status: http.StatusOK}, nil
+}
+
+// GetScope get one Github repo
+// @Summary get one Github repo
+// @Description get one Github repo
+// @Tags plugins/github
+// @Param connectionId path int false "connection ID"
+// @Param repoId path int false "repo ID"
+// @Success 200  {object} models.GithubRepo
+// @Failure 400  {object} shared.ApiBody "Bad Request"
+// @Failure 500  {object} shared.ApiBody "Internal Error"
+// @Router /plugins/github/connections/{connectionId}/scopes/{repoId} [GET]
+func GetScope(input *core.ApiResourceInput) (*core.ApiResourceOutput, errors.Error) {
+	var repo models.GithubRepo
+	connectionId, repoId := extractParam(input.Params)
+	if connectionId*repoId == 0 {
+		return nil, errors.BadInput.New("invalid path params")
+	}
+	err := basicRes.GetDal().First(&repo, dal.Where("connection_id = ? AND github_id = ?", connectionId, repoId))
+	if err != nil {
+		return nil, err
+	}
+	return &core.ApiResourceOutput{Body: repo, Status: http.StatusOK}, nil
+}
+
+func extractParam(params map[string]string) (uint64, uint64) {
+	connectionId, _ := strconv.ParseUint(params["connectionId"], 10, 64)
+	repoId, _ := strconv.ParseUint(params["repoId"], 10, 64)
+	return connectionId, repoId
+}
+
+func verifyRepo(repo *models.GithubRepo) errors.Error {
+	if repo.ConnectionId == 0 {
+		return errors.BadInput.New("invalid connectionId")
+	}
+	if repo.GithubId == 0 {

Review Comment:
   same as above



##########
plugins/github/tasks/task_data.go:
##########
@@ -55,40 +56,43 @@ func DecodeAndValidateTaskOptions(options map[string]interface{}) (*GithubOption
 	if op.Repo == "" {
 		return nil, errors.BadInput.New("repo is required for GitHub execution")
 	}
-	if op.PrType == "" {
-		op.PrType = "type/(.*)$"
-	}
-	if op.PrComponent == "" {
-		op.PrComponent = "component/(.*)$"
-	}
-	if op.PrBodyClosePattern == "" {
-		op.PrBodyClosePattern = "(?mi)(fix|close|resolve|fixes|closes|resolves|fixed|closed|resolved)[\\s]*.*(((and )?(#|https:\\/\\/github.com\\/%s\\/%s\\/issues\\/)\\d+[ ]*)+)"
-	}
-	if op.IssueSeverity == "" {
-		op.IssueSeverity = "severity/(.*)$"
-	}
-	if op.IssuePriority == "" {
-		op.IssuePriority = "^(highest|high|medium|low)$"
-	}
-	if op.IssueComponent == "" {
-		op.IssueComponent = "component/(.*)$"
-	}
-	if op.IssueTypeBug == "" {
-		op.IssueTypeBug = "^(bug|failure|error)$"
-	}
-	if op.IssueTypeIncident == "" {
-		op.IssueTypeIncident = ""
-	}
-	if op.IssueTypeRequirement == "" {
-		op.IssueTypeRequirement = "^(feat|feature|proposal|requirement)$"
-	}
-	if op.DeploymentPattern == "" {
-		op.DeploymentPattern = "(?i)deploy"
-	}
-
 	// find the needed GitHub now
 	if op.ConnectionId == 0 {
 		return nil, errors.BadInput.New("connectionId is invalid")
 	}
+	if op.TransformationRules == nil && op.TransformationRuleId == 0 {

Review Comment:
   no more default value



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] mindlesscloud commented on a diff in pull request #3803: feat: github support scope and transformation rule

Posted by GitBox <gi...@apache.org>.
mindlesscloud commented on code in PR #3803:
URL: https://github.com/apache/incubator-devlake/pull/3803#discussion_r1034329372


##########
plugins/jira/models/board.go:
##########
@@ -25,7 +25,7 @@ type JiraBoard struct {
 	common.NoPKModel
 	ConnectionId         uint64 `gorm:"primaryKey"`
 	BoardId              uint64 `gorm:"primaryKey"`
-	ScopeId              string
+	ScopeId              string `gorm:"type:varchar(255)"`

Review Comment:
   I will remove `ScopeId` from tool layer tables



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #3803: feat: github support scope and transformation rule

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #3803:
URL: https://github.com/apache/incubator-devlake/pull/3803#discussion_r1033277007


##########
plugins/jira/models/board.go:
##########
@@ -25,7 +25,7 @@ type JiraBoard struct {
 	common.NoPKModel
 	ConnectionId         uint64 `gorm:"primaryKey"`
 	BoardId              uint64 `gorm:"primaryKey"`
-	ScopeId              string
+	ScopeId              string `gorm:"type:varchar(255)"`

Review Comment:
   is this scopeId a domain id?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh merged pull request #3803: feat: github support scope and transformation rule

Posted by GitBox <gi...@apache.org>.
klesh merged PR #3803:
URL: https://github.com/apache/incubator-devlake/pull/3803


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org