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/15 03:55:06 UTC

[GitHub] [incubator-devlake] keon94 commented on a diff in pull request #3730: feat: add "enable graphql" in config-ui

keon94 commented on code in PR #3730:
URL: https://github.com/apache/incubator-devlake/pull/3730#discussion_r1022291610


##########
plugins/github/api/blueprint.go:
##########
@@ -114,20 +114,42 @@ func makePipelinePlan(subtaskMetas []core.SubTaskMeta, scope []*core.BlueprintSc
 			return repo, err
 		}
 
-		// construct subtasks
-		subtasks, err := helper.MakePipelinePlanSubtasks(subtaskMetas, scopeElem.Entities)
-		if err != nil {
-			return nil, err
-		}
 		stage := plan[i]
 		if stage == nil {
 			stage = core.PipelineStage{}
 		}
-		stage = append(stage, &core.PipelineTask{
-			Plugin:   "github",
-			Subtasks: subtasks,
-			Options:  options,
-		})
+
+		// construct github(graphql) task
+		if connection.EnableGraphql {
+			// FIXME this need fix when 2 plugins merged
+			plugin, err := core.GetPlugin(`github_graphql`)
+			if err != nil {
+				return nil, err
+			}
+			if pluginGq, ok := plugin.(core.PluginTask); ok {
+				subtasks, err := helper.MakePipelinePlanSubtasks(pluginGq.SubTaskMetas(), scopeElem.Entities)
+				if err != nil {
+					return nil, err
+				}
+				stage = append(stage, &core.PipelineTask{
+					Plugin:   "github_graphql",
+					Subtasks: subtasks,
+					Options:  options,
+				})
+			} else {
+				return nil, errors.Default.New("plugin github_graphql does not support SubTaskMetas")

Review Comment:
   It looks like BadInput may be a better error type for this. "Default" translates to err 500 for new errors



-- 
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