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.