Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merge request changes not returned by the API #829

Open
AxelReviron opened this issue Feb 28, 2025 · 0 comments
Open

Merge request changes not returned by the API #829

AxelReviron opened this issue Feb 28, 2025 · 0 comments

Comments

@AxelReviron
Copy link

Hello,

I've encountered an issue where the changes from a merge request response appear to be empty. Here's my code:

$mergeRequestChanges = $this->gitlab->mergeRequests()->changes(
    $mergeRequest->project->gitlab_id,
    $gitlabResponse['iid']
);

dd($mergeRequestChanges);

This is the response from the API (some data has been anonymized for confidentiality, but all relevant information is included):

array:62 [
  "id" => XXXX
  "iid" => XX
  "project_id" => XXXX
  "title" => "My title"
  "description" => "description"
  "state" => "opened"
  "created_at" => "2025-02-28T10:18:33.695Z"
  "updated_at" => "2025-02-28T10:18:33.695Z"
  "merged_by" => null
  "merge_user" => null
  "merged_at" => null
  "closed_by" => null
  "closed_at" => null
  "target_branch" => "main"
  "source_branch" => "feature/test"
  "user_notes_count" => 0
  "upvotes" => 0
  "downvotes" => 0
  "author" => array:7 [
    "id" => 407
    "username" => "username"
    "name" => "name"
    "state" => "active"
    "locked" => false
    "avatar_url" => "https://secure.gravatar.com"
    "web_url" => "https://gitlab.compagny.fr/username"
  ]
  "assignees" => []
  "assignee" => null
  "reviewers" => []
  "source_project_id" => XXXX
  "target_project_id" => XXXX
  "labels" => []
  "draft" => false
  "imported" => false
  "imported_from" => "none"
  "work_in_progress" => false
  "milestone" => null
  "merge_when_pipeline_succeeds" => false
  "merge_status" => "checking"
  "detailed_merge_status" => "preparing"
  "sha" => "e3318ef59387b790d589f5b2821726d14d7393a8"
  "merge_commit_sha" => null
  "squash_commit_sha" => null
  "discussion_locked" => null
  "should_remove_source_branch" => null
  "force_remove_source_branch" => null
  "prepared_at" => null
  "reference" => "!32"
  "references" => array:3 [
    "short" => "!32"
    "relative" => "!32"
    "full" => "compagny/team/project!32"
  ]
  "web_url" => "https://gitlab.compagny.fr/compagny/team/project/-/merge_requests/32"
  "time_stats" => array:4 [
    "time_estimate" => 0
    "total_time_spent" => 0
    "human_time_estimate" => null
    "human_total_time_spent" => null
  ]
  "squash" => false
  "squash_on_merge" => false
  "task_completion_status" => array:2 [
    "count" => 0
    "completed_count" => 0
  ]
  "has_conflicts" => false
  "blocking_discussions_resolved" => true
  "approvals_before_merge" => null
  "subscribed" => true
  "changes_count" => null // This is not supposed to be null
  "latest_build_started_at" => null
  "latest_build_finished_at" => null
  "first_deployed_to_production_at" => null
  "pipeline" => null
  "head_pipeline" => null
  "diff_refs" => null
  "merge_error" => null
  "user" => array:1 [
    "can_merge" => true
  ]
  "changes" => [] // The array is empty
  "overflow" => false
]

As you can see, my merge request has 2 changes, but they are not returned by the API.
Image

Additionally, I have a question: I've been searching for the following routes in the library but can't find them:

  • GET /projects/:id/merge_requests/:merge_request_iid/diffs
  • GET /projects/:id/merge_requests/:merge_request_iid/raw_diffs

Are there any plans to implement these ? May I create a pull request for this ?

Thank you.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

1 participant