capability_id: issue.labels.add
version: "1.0.0"
description: Add labels to an issue without removing existing labels.
input_schema:
  type: object
  required: [owner, name, issueNumber, labels]
  properties:
    owner: { type: string, minLength: 1 }
    name: { type: string, minLength: 1 }
    issueNumber: { type: integer, minimum: 1 }
    labels:
      type: array
      items: { type: string, minLength: 1 }
      minItems: 1
  additionalProperties: false
output_schema:
  type: object
  required: [id, labels]
  properties:
    id: { type: string, minLength: 1 }
    labels:
      type: array
      items: { type: string }
  additionalProperties: false
routing:
  preferred: graphql
  fallbacks: []
graphql:
  operationName: IssueLabelsAdd
  operationType: mutation
  documentPath: src/gql/operations/issue-labels-add.graphql
  resolution:
    lookup:
      operationName: IssueLabelsLookupByNumber
      documentPath: src/gql/operations/issue-labels-lookup-by-number.graphql
      vars:
        owner: owner
        name: name
        issueNumber: issueNumber
    inject:
      - target: labelableId
        source: scalar
        path: repository.issue.id
      - target: labelIds
        source: map_array
        from_input: labels
        nodes_path: repository.labels.nodes
        match_field: name
        extract_field: id
