Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #6648

Closed
Open
Created Mar 28, 2014 by Administrator@rootOwner

Merge Requests API data missing source and target commit SHA

Created by: mikeholler

I was hoping to use GitHub's API to help ensure that all of our developers' commits receive a code review in the form of merge request comments with a final signoff message once outstanding issues have been fixed. When using the API (GitLab 6.4.3), I found the only relevant data GitLab returns for merge requests are source_branch, source_project_id, target_branch, and target_project_id. Here is an example of what these fields look like:

{
    ...
    "source_branch": "development",
    "source_project_id": 9,
    "target_branch": "master",
    "target_project_id": 9
    ...
}

GitLab should return the SHA commit hash for the source and target branches. These SHAs should update whenever more commits are pushed to a named commit point, like a branch or tag (e.g., master, v1.0.2) until either:

  • The merge request has been merged
  • The merge request has been closed

GitHub provides commit SHAs for Pull Requests in their API, and perhaps that can be used as a reference to resolve this issue. Here is a suggestion for how this data might be returned by the GitLab API:

{
    ...
    "source_branch": "development",
    "source_project_id": 9,
    "source_sha": "743803de635cbcc9001a61ab8498261b1acb3e83",
    "target_branch": "master",
    "target_project_id": 9,
    "target_sha": "01b353f1ff4b15712d22400d10b44c6d00c79898"
    ...
}

As it is now, it is impossible to tell which commits closed or merged merge requests affected at the time of their resolution, making the merge requests calls to the API useless for reporting purposes.

EDIT: I do realize this functionality is available through Web Hooks, however it is unrealistic to expect a system to be listening on the hooks 24/7 so that they have the proper information to generate a report months after a merge request was made or updated.

image

Assignee
Assign to
Time tracking