Skip to content
Snippets Groups Projects

Add GraphQL mutation to promote an issue to an epic

Merged Alexandru Croitor requested to merge 233974-promote-issue-to-epic into master
All threads resolved!

What does this MR do?

Exposes promote issue to epic through GraphQL mutation

Promote to epic within project parent group

  • GraphqQL mutation
mutation {
  promoteToEpic(input: {
    projectPath: "gitlab-org/gitlab-shell", 
    iid: "1"     
  }) {    
    issue {
      id
      iid
      title
      state
      milestone {
        id
        title
      }
    }
    epic {
      id
      iid
      title
    }
    errors
  }
}
  • Response with success
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": {
        "id": "gid://gitlab/Epic/5",
        "iid": "3",
        "title": "First issue"
      },
      "errors": []
    }
  }
}
  • Response with error
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": null,
      "errors": [
        "Issue already promoted to epic."
      ]
    }
  }
}

Promote to epic to a specified group

  • Graphql mutation
mutation {
  promoteToEpic(input: {
    projectPath: "gitlab-org/gitlab-shell", 
    iid: "1",
    epicGroupPath: "gitlab-org/gitlab-sugroup-1"
  }) {    
    issue {
      id
      iid
      title
      state
      milestone {
        id
        title
      }
    }
    epic {
      id
      iid
      title
    }
    errors
  }
}
  • response with success
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": {
        "id": "gid://gitlab/Epic/6",
        "iid": "1",
        "title": "First issue"
      },
      "errors": []
    }
  }
}
  • response with error
{
  "data": {
    "promoteToEpic": {
      "issue": {
        "id": "gid://gitlab/Issue/2",
        "iid": "1",
        "title": "First issue",
        "state": "closed",
        "milestone": {
          "id": "gid://gitlab/Milestone/9",
          "title": "v3.0"
        }
      },
      "epic": null,
      "errors": [
        "Issue already promoted to epic."
      ]
    }
  }
}

Promote to epic to an inexistent group

  • Graphql mutation
mutation {
  promoteToEpic(input: {
    projectPath: "gitlab-org/gitlab-shell", 
    iid: "1",
    epicGroupPath: "gitlab-org/gitlab-sugroup-1/abracadabra"
  }) {    
    issue {
      id
      iid
      title
      state
      milestone {
        id
        title
      }
    }
    epic {
      id
      iid
      title
    }
    errors
  }
}
  • response
{
  "data": {
    "promoteToEpic": null
  },
  "errors": [
    {
      "message": "The resource that you are attempting to access does not exist or you don't have permission to perform this action",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "promoteToEpic"
      ]
    }
  ]
}

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #233974 (closed)

Edited by Alexandru Croitor

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Furkan Ayhan approved this merge request

    approved this merge request

  • Alexandru Croitor added 345 commits

    added 345 commits

    Compare with previous version

  • Alexandru Croitor resolved all threads

    resolved all threads

  • added 1 commit

    • bee1664f - Add GraphQL mutation to promote an issue to an epic

    Compare with previous version

  • @lulalala would you please take the maintainer review ?

    • Resolved by Mark Chao

      I also don't have much experience in GraphQL either. Could I ask for an extra pair of eye on this?

      Hi @egrieff would you have time to review this please? I see you have worked on SetEpic in the past. Thanks :bow:

  • assigned to @egrieff

  • Mark Chao
  • Alexandru Croitor added 466 commits

    added 466 commits

    Compare with previous version

  • added 1 commit

    • 1523c5c4 - Add GraphQL mutation to promote an issue to an epic

    Compare with previous version

  • Alexandru Croitor added 356 commits

    added 356 commits

    Compare with previous version

  • Mark Chao approved this merge request

    approved this merge request

  • Mark Chao resolved all threads

    resolved all threads

  • Mark Chao enabled an automatic merge when the pipeline for 697e0d86 succeeds

    enabled an automatic merge when the pipeline for 697e0d86 succeeds

  • merged

  • Mark Chao mentioned in commit 4500f057

    mentioned in commit 4500f057

  • Mark Chao mentioned in commit c323b25d

    mentioned in commit c323b25d

  • Mark Chao mentioned in commit a5039868

    mentioned in commit a5039868

  • added workflowstaging label and removed workflowin dev label

  • added workflowcanary label and removed workflowstaging label

  • added workflowproduction label and removed workflowcanary label

  • Please register or sign in to reply
    Loading