MCPcopy Create free account
hub / github.com/bytebase/bytebase / createIssue

Method createIssue

backend/api/mcp/tool_change.go:440–470  ·  view source on GitHub ↗

createIssue creates an issue linked to a plan.

(ctx context.Context, project, title, planName, description string)

Source from the content-addressed store, hash-verified

438
439// createIssue creates an issue linked to a plan.
440func (s *Server) createIssue(ctx context.Context, project, title, planName, description string) (string, string, error) {
441 issue := map[string]any{
442 "title": title,
443 "type": "DATABASE_CHANGE",
444 "plan": planName,
445 }
446 if description != "" {
447 issue["description"] = description
448 }
449 body := map[string]any{
450 "parent": project,
451 "issue": issue,
452 }
453
454 resp, err := s.apiRequest(ctx, "/bytebase.v1.IssueService/CreateIssue", body)
455 if err != nil {
456 return "", "", errors.Wrap(err, "issue creation request failed")
457 }
458 if err := checkAPIResponse(resp, "create issues", "bb.issues.create"); err != nil {
459 return "", "", err
460 }
461
462 var result struct {
463 Name string `json:"name"`
464 ApprovalStatus string `json:"approvalStatus"`
465 }
466 if err := json.Unmarshal(resp.Body, &result); err != nil {
467 return "", "", errors.Wrap(err, "failed to parse CreateIssue response")
468 }
469 return result.Name, result.ApprovalStatus, nil
470}
471
472// createRollout creates a rollout for a plan.
473func (s *Server) createRollout(ctx context.Context, planName string) (string, error) {

Callers 1

handleChangeMethod · 0.95

Calls 3

apiRequestMethod · 0.95
checkAPIResponseFunction · 0.85
UnmarshalMethod · 0.80

Tested by

no test coverage detected