跳到主要内容

Pull Request Event

Pull Request合并请求事件参数说明

请求头

参数名称类型参数说明
User-Agentstring
Content-Typestring
X-GitCode-Eventstring事件类型,Merge Request Hook代表合并请求事件
X-GitCode-Deliverystring请求唯一id

请求参数

参数名称参数类型参数说明
produce_random_idstring随机生成的事件ID
event_typestring事件类型,此处为 "merge_request"
object_kindstring对象类型,此处为 "merge_request"
git_branchstringGit分支名称
git_commit_nostring当前提交SHA
git_target_branch_commit_nostring目标分支提交SHA
manual_buildboolean
virtual_merge_buildboolean
uuidstring事件唯一标识符
labelsarray标签列表
issuesarray关联的issue列表
object_attributes.idinteger合并请求的ID
object_attributes.iidinteger合并请求在项目中的ID
object_attributes.titlestring合并请求标题
object_attributes.descriptionstring合并请求描述
object_attributes.statestring合并请求状态(opened: 开启的,merged: 已合并,closed: 关闭的)
object_attributes.created_atstring创建时间
object_attributes.updated_atstring更新时间
object_attributes.actionstring操作类型(open:开启, update: 更新, merge:合并, close: 关闭)
object_attributes.work_in_progressboolean是否为进行中的工作
object_attributes.merge_statusstring合并状态(unchecked: 未检查)
object_attributes.merge_when_pipeline_succeedsboolean是否在流水线成功后自动合并
object_attributes.source_branchstring源分支名称
object_attributes.target_branchstring目标分支名称
object_attributes.source_project_idinteger源项目ID
object_attributes.target_project_idinteger目标项目ID
object_attributes.author_idinteger作者ID
object_attributes.urlstring合并请求的Web访问地址
object_attributes.need_reviewboolean是否需要评审
object_attributes.need_testboolean是否需要测试
object_attributes.conflictboolean是否存在冲突
object_attributes.total_time_spentinteger
object_attributes.oldrevstring旧版本提交号
object_attributes.update_reasonstring更新原因
object_attributes.reviewer_listarray评审者列表
object_attributes.assignee_listarray指派人列表
object_attributes.last_commit.idstring最后一次提交的SHA值
object_attributes.last_commit.messagestring最后一次提交信息
object_attributes.last_commit.timestampstring最后一次提交时间戳
object_attributes.last_commit.urlstring最后一次提交详情页面URL
object_attributes.last_commit.author.namestring最后一次提交作者名称
object_attributes.last_commit.author.emailstring最后一次提交作者邮箱
object_attributes.target_branch_commit.idstring目标分支提交的SHA值
object_attributes.target_branch_commit.messagestring目标分支提交信息
object_attributes.target_branch_commit.timestampstring目标分支提交时间戳
object_attributes.target_branch_commit.urlstring目标分支提交详情页面URL
object_attributes.target_branch_commit.author.namestring目标分支提交作者名称
object_attributes.target_branch_commit.author.emailstring目标分支提交作者邮箱
object_attributes.merge_params.force_remove_source_branchboolean是否强制删除源分支
object_attributes.source.idinteger源项目ID
object_attributes.source.namestring源项目名称
object_attributes.source.path_with_namespacestring源项目带命名空间的路径
object_attributes.source.namespacestring源项目命名空间
object_attributes.source.visibility_levelinteger源项目可见性级别(0: 私有, 1: 公开)
object_attributes.source.web_urlstring源项目Web访问地址
object_attributes.source.urlstring源项目Git仓库URL
object_attributes.source.http_urlstring源项目HTTP克隆地址
object_attributes.source.ssh_urlstring源项目SSH克隆地址
object_attributes.source.git_http_urlstring源项目Git HTTP克隆地址
object_attributes.source.git_ssh_urlstring源项目Git SSH克隆地址
object_attributes.source.homepagestring源项目主页
object_attributes.source.avatar_urlstring源项目头像URL
object_attributes.source.default_branchstring源项目默认分支
object_attributes.targetobject目标项目信息(字段同source)
object_attributes.author.idinteger作者ID
object_attributes.author.namestring作者名称
object_attributes.author.usernamestring作者登录名
object_attributes.author.emailstring作者邮箱
object_attributes.author.avatar_urlstring作者头像URL
changes.merge_params.currentstring当前合并参数设置
changes.patchset_locked.currentboolean
changes.merge_when_pipeline_succeeds.currentboolean当前流水线成功后自动合并设置
changes.iid.currentinteger当前合并请求IID
changes.target_branch.currentstring当前目标分支
changes.created_at.currentstring当前创建时间
changes.description.currentstring当前描述
changes.close_issue_when_merge.currentboolean合并时是否自动关闭关联的issue
changes.moderation_result.currentboolean
changes.source_project_id.currentinteger源项目ID
changes.title.currentstring当前标题
changes.current_patchset_id.currentinteger
changes.source_branch.currentstring源分支
changes.squash.currentboolean当前是否压缩提交
changes.updated_at.currentstring当前更新时间
changes.merge_status.currentstring当前合并状态
changes.moderation_time.currentinteger当前审核时间
changes.latest_merge_request_diff_id.currentinteger当前最新合并请求差异ID
changes.id.currentinteger当前合并请求ID
changes.state.currentstring当前状态
changes.author_id.currentinteger当前作者ID
changes.target_project_id.currentinteger当前目标项目ID
projectobject项目信息(字段同object_attributes.source)
repositoryobject仓库信息(字段同object_attributes.source)
userobject触发事件的用户信息(字段同object_attributes.author)

请求参数示例

{
"produce_random_id": "f2378f237c994e368e28b40e25210a97",
"event_type": "merge_request",
"object_kind": "merge_request",
"object_attributes": {
"id": 6830111,
"iid": 27,
"title": "update: 更新文件 README.md",
"description": "update: 更新文件 README.md ",
"state": "opened",
"created_at": "2025-05-07T14:43:39+08:00",
"updated_at": "2025-05-07T14:43:40+08:00",
"action": "open",
"work_in_progress": false,
"merge_status": "unchecked",
"merge_when_pipeline_succeeds": false,
"source_branch": "test333",
"target_branch": "main",
"source_project_id": 1848674,
"target_project_id": 1848674,
"author_id": 173794,
"url": "https://gitcode.com/xiaogang_o/test/merge_requests/27",
"need_review": false,
"need_test": false,
"conflict": false,
"total_time_spent": 0,
"merge_params": {
"force_remove_source_branch": false
},
"reviewer_list": [],
"assignee_list": [],
"oldrev": "",
"update_reason": "",
"last_commit": {
"id": "23adec6d9afeb011992b73d700c854ee9388205f",
"message": "update: 更新文件 README.md Signed-off-by: xiaogang <xiaogang@csdn.net>",
"timestamp": "2024-12-06T06:46:48Z",
"url": "https://gitcode.com/xiaogang_o/test/commits/detail/23adec6d9afeb011992b73d700c854ee9388205f",
"author": {
"name": "xiaogang",
"email": "xiaogang@csdn.net"
}
}
},
"changes": {
"merge_params": {
"current": "force_remove_source_branch: false"
},
"patchset_locked": {
"current": false
},
"squash": {
"current": false
},
"close_issue_when_merge": {
"current": false
}
},
"project": {
"id": 1848674,
"name": "test",
"web_url": "https://gitcode.com/xiaogang_o/test",
"git_ssh_url": "git@gitcode.com:xiaogang_o/test.git",
"git_http_url": "https://gitcode.com/xiaogang_o/test.git",
"namespace": "xiaogang_o",
"visibility_level": 0,
"path_with_namespace": "xiaogang_o/test",
"default_branch": "main"
},
"user": {
"id": 173794,
"name": "xiaogang_o",
"username": "xiaogang_o",
"email": "xiaogang@csdn.net",
"avatar_url": "https://cdn-img.gitcode.com/ee/ca/756863eec250a6a067148d4d4fe71d28c3b9716a6f79c03a9f460543fa3dc838.jpg?time=1711433667506"
},
"manual_build": false,
"virtual_merge_build": true,
"git_branch": "merge-requests/27/merge",
"git_commit_no": "7083553a6d16960c879dd601db307b565f2994bb",
"git_target_branch_commit_no": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"uuid": "27_637deb9c-5c95-480f-8530-4d91006c72df"
}