capability_id: project_v2.items.issue.add
version: "1.0.0"
description: Add an issue to a Projects v2 project.
input_schema:
  type: object
  required: [owner, projectNumber, issueUrl]
  properties:
    owner: { type: string, minLength: 1 }
    projectNumber: { type: integer, minimum: 1 }
    issueUrl: { type: string, minLength: 1 }
  additionalProperties: false
output_schema:
  type: object
  required: [itemId, itemType]
  properties:
    itemId: { type: string }
    itemType: { type: [string, "null"] }
  additionalProperties: false
routing:
  preferred: graphql
  fallbacks: [cli]
graphql:
  operationName: AddProjectV2Item
  operationType: mutation
  documentPath: src/gql/operations/project-v2-item-add.graphql
  resolution:
    lookups:
      - id: projectOwner
        operationName: ProjectV2OwnerId
        documentPath: src/gql/operations/project-v2-owner-id.graphql
        vars:
          owner: owner
          projectNumber: projectNumber
      - id: content
        operationName: ProjectV2IssueNodeId
        documentPath: src/gql/operations/project-v2-issue-node-id.graphql
        vars:
          url: issueUrl
    inject:
      - target: projectId
        source: scalar
        from_lookup: projectOwner
        path: repositoryOwner.projectV2.id
      - target: contentId
        source: scalar
        from_lookup: content
        path: resource.id
cli:
  command: project item-add
