Skip to content

Add Issue.relatedMergeRequests to GraphQL API

What does this MR do and why?

This adds the ability to query the related merge requests for an issue.

Screenshots or screen recordings

image

How to set up and validate locally

Search an issue with related merge requests (or just mention some merge requests in a comment in that issue)

  1. Mention a Merge Request in an issue
  2. Execute the relatedMrSingleIssue query
  3. Execute the relatedMrMultiIssue query and observe, that only one issue gets its relatedMergeRequests value and the others get an error
query relatedMrSingleIssue {
  project(fullPath: "<project-path>") {
    issue(iid: "<issue-iid>") {
      relatedMergeRequests {
        count
        nodes {
          title
          project {
            fullPath
          }
          reference
        }
      }
    }
  }
}

query relatedMrMultiIssue {
  project(fullPath: "gitlab-org/gitlab-test") {
    issues {
      nodes {
        relatedMergeRequests {
          count
          nodes {
            title
            project {
              fullPath
            }
            reference
          }
        }
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Niklas van Schrick

Merge request reports