Commit Event
Commit事件参数说明
请求头
参数名称 | 类型 | 参数说明 |
---|---|---|
User-Agent | string | |
Content-Type | string | |
X-GitCode-Event | string | 事件类型,Push Hook代表推送事件 |
X-GitCode-Delivery | string | 请求唯一id |
请求参数
参 数名称 | 参数类型 | 参数说明 |
---|---|---|
object_kind | string | 事件类型,此处为 "push" 表示推送事件 |
event_name | string | 事件名称,与 object_kind 相同,表示推送事件 |
before | string | 推送前的提交 SHA 值 |
after | string | 推送后的提交 SHA 值 |
ref | string | Git 引用路径,例如 "refs/heads/main" 表示主分支 |
checkout_sha | string | 检出的提交 SHA 值 |
message | string | 消息内容 |
user_id | integer | 触发推送事件的用户 ID |
user_name | string | 用户的显示名称 |
user_username | string | 用户的用户名 |
user_email | string | 用户的邮箱地址 |
user_avatar | string | 用户头像的 URL 地址 |
project_id | integer | 项目的唯一标识符 |
project.id | integer | 项目 ID |
project.name | string | 项目名称 |
project.description | string | 项目描述 |
project.web_url | string | 项目的 Web 访问地址 |
project.avatar_url | string | 项目头像的 URL 地址 |
project.git_ssh_url | string | 项目的 SSH 克隆地址 |
project.git_http_url | string | 项目的 HTTP 克隆地址 |
project.namespace | string | 项目的命名空间 |
project.visibility_level | integer | 项目可见性级别(0: 私有, 1:公开) |
project.path_with_namespace | string | 带命名空间的项目路径 |
project.default_branch | string | 项 目的默认分支 |
project.homepage | string | 项目主页 URL |
project.url | string | 项目 Git 仓库 URL |
project.ssh_url | string | 项目 SSH 克隆 URL |
project.http_url | string | 项目 HTTP 克隆 URL |
commits[].id | string | 提交的 SHA 值 |
commits[].message | string | 提交信息 |
commits[].timestamp | string | 提交时间戳 |
commits[].url | string | 提交详情页面的 URL |
commits[].author.name | string | 提交作者的名称 |
commits[].author.email | string | 提交作者的邮箱 |
commits[].added | array | 本次提交新增的文件列表 |
commits[].removed | array | 本次提交删除的文件列表 |
commits[].modified | array | 本次提交修改的文件列表 |
total_commits_count | integer | 本次推送的提交总数 |
push_options | array | 推送选项数组 |
repository.name | string | 仓库名称 |
repository.url | string | 仓库 Git URL |
repository.description | string | 仓库描述 |
repository.homepage | string | 仓库主页 URL |
repository.git_http_url | string | 仓库 HTTP 克隆地址 |
repository.git_ssh_url | string | 仓库 SSH 克隆地址 |
repository.visibility_level | integer | 仓库可见性级别(0: 私有, 1: 公开) |
git_branch | string | 推送的目标分支名称 |
git_commit_no | string | 最新提交的 SHA 值 |
manual_build | boolean | |
uuid | string | 本次推送事件的唯一标识符 |
请求参数示例
{
"object_kind": "push",
"event_name": "push",
"before": "1d27e394fbd0491f139dd2e577aa3e214a2fc18e",
"after": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"ref": "refs/heads/main",
"checkout_sha": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"message": "",
"user_id": 173794,
"user_name": "xiaogang_o",
"user_username": "xiaogang_o",
"user_email": "",
"user_avatar": "https://cdn-img.gitcode.com/ee/ca/756863eec250a6a067148d4d4fe71d28c3b9716a6f79c03a9f460543fa3dc838.jpg?time=1711433667506",
"project_id": 1848674,
"project": {
"id": 1848674,
"name": "test",
"web_url": "https://gitcode.com/xiaogang_o/test",
"avatar_url": "https://cdn-img.gitcode.com/ee/ca/756863eec250a6a067148d4d4fe71d28c3b9716a6f79c03a9f460543fa3dc838.jpg?time=1711433667506",
"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",
"homepage": "https://gitcode.com/xiaogang_o/test",
"url": "git@gitcode.com:xiaogang_o/test.git",
"ssh_url": "git@gitcode.com:xiaogang_o/test.git",
"http_url": "https://gitcode.com/xiaogang_o/test.git"
},
"commits": [
{
"id": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"message": "update: 更新文件 你好.txtSigned-off-by: xiaogang_o <xiaogang@csdn.net>",
"timestamp": "2025-05-07T05:58:22Z",
"url": "https://gitcode.com/xiaogang_o/test/commits/detail/d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"author": {
"name": "xiaogang_o",
"email": "xiaogang@csdn.net"
},
"added": [],
"removed": [],
"modified": [
"你好.txt"
]
}
],
"total_commits_count": 1,
"push_options": [],
"repository": {
"name": "test",
"url": "git@gitcode.com:xiaogang_o/test.git",
"homepage": "https://gitcode.com/xiaogang_o/test",
"git_http_url": "https://gitcode.com/xiaogang_o/test.git",
"git_ssh_url": "git@gitcode.com:xiaogang_o/test.git",
"visibility_level": 0
},
"git_branch": "main",
"git_commit_no": "d55f9d34de9537bddaae80d6dcfe07aaa15e957a",
"manual_build": false,
"uuid": "d6869f2d-56a3-4b77-90ee-f4957e582df6"
}