Skip to content

API Project-level MR approvals: response incorrect

Summary

API responds with approvals_before_merge: 0, even though there are approvers in the project.

Steps to reproduce

  1. Create project
  2. Add members to project
  3. Create approval rule with > 0 approvals
  4. Use the API to GET Project-level MR approvals

Example Project

https://gitlab.com/nelbacha/merge-requests-approvals-api

What is the current bug behavior?

API responds with 0

What is the expected correct behavior?

API responds with amount of approvals required

Relevant logs and/or screenshots

image

Output of checks

This bug happens on GitLab.com

https://gitlab.com/api/v4/projects/15364121/approvals

{
approvers: [ ],
approver_groups: [ ],
approvals_before_merge: 0,
reset_approvals_on_push: true,
disable_overriding_approvers_per_merge_request: null,
merge_requests_author_approval: null,
merge_requests_disable_committers_approval: null
}

https://gitlab.com/api/v4/projects/15364121/approval_rules

[
{
id: 105908,
name: "test",
rule_type: "regular",
eligible_approvers: [
{
id: 1786152,
name: "🤖 GitLab Bot 🤖",
username: "gitlab-bot",
state: "active",
avatar_url: "https://assets.gitlab-static.net/uploads/-/system/user/avatar/1786152/avatar.png",
web_url: "https://gitlab.com/gitlab-bot"
}
],
approvals_required: 1,
users: [
{
id: 1786152,
name: "🤖 GitLab Bot 🤖",
username: "gitlab-bot",
state: "active",
avatar_url: "https://assets.gitlab-static.net/uploads/-/system/user/avatar/1786152/avatar.png",
web_url: "https://gitlab.com/gitlab-bot"
}
],
groups: [ ],
contains_hidden_groups: false
}
]

ZD#138851 (GitLab Internal)

Edited by 🤖 GitLab Bot 🤖