Feature Request: Add Approver Filter to Merge Requests in GitLab GraphQL API
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
Feature Description
Currently, the GitLab GraphQL API does not support filtering merge requests by approvers. This functionality is available in the REST API via the approver_ids[] parameter, but it is missing in the GraphQL API. This feature request proposes adding a new filter option to the mergeRequests query in the GraphQL API to allow users to query merge requests where they are listed as an approver.
Use Case
As a developer or project maintainer, I want to query merge requests where I am an approver using the GraphQL API. This is particularly useful for:
- Automating approval workflows.
- Generating reports or dashboards for merge requests requiring my approval.
- Integrating with external tools that rely on GraphQL for data fetching.
Technical Details
The proposed solution involves adding a new filter parameter to the mergeRequests query in the GraphQL API. The parameter could be named approverUsernames or approverIds, similar to the existing assigneeUsername and reviewerUsername filters. For example:
query {
project(fullPath: "namespace/project") {
mergeRequests(approverUsernames: ["your-username"]) {
nodes {
id
title
state
approvals {
approvedBy {
nodes {
username
}
}
}
}
}
}
}
This would return merge requests where the specified user(s) are listed as approvers.
Related Issues and Epics
- REST API Documentation: Merge Requests API
- GraphQL API Documentation: Merge Requests in GraphQL
- Feature Proposal Template: Feature Proposal - Detailed
What Does Success Look Like, and How Can We Measure That?
-
Success Criteria:
- Users can query merge requests using the
approverUsernamesorapproverIdsfilter in the GraphQL API. - The feature is documented in the GitLab GraphQL API reference.
- The feature is available in all GitLab tiers (Free, Premium, Ultimate).
- Users can query merge requests using the
-
Metrics:
- Adoption rate of the new filter in the GraphQL API.
- Positive feedback from users in issue comments or forums.
- Reduction in requests for workarounds using the REST API.