使用GitLab API文档,我可以获得项目的提交。
***卷曲命令
curl -X GET -H "PRIVATE-TOKEN: tc5W6MZSREQb6XLCZx5-" "http://192.168.8.200:8081/api/v4/projects/4/repository/commits/master"
***样本输出
{
"id": "79653d97fef4e0e202439b4fddc9833d8d24433a",
"short_id": "79653d97",
"created_at": "2019-06-18T05:37:54.000Z",
"parent_ids": [
"e571470e928418f73938e453da7d69c7d306b004"
],
"title": "Update Jenkinsfile",
"message": "Update Jenkinsfile",
"author_name": "Administrator",
"author_email": "admin@example.com",
"authored_date": "2019-06-18T05:37:54.000Z",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2019-06-18T05:37:54.000Z",
"stats": {
"additions": 1,
"deletions": 2,
"total": 3
},
"status": "failed",
"last_pipeline": {
"id": 35,
"sha": "79653d97fef4e0e202439b4fddc9833d8d24433a",
"ref": "master",
"status": "failed",
"web_url": "http://example.gitlab.com/adl-dte/create-app/pipelines/35"
},
"project_id": 4
}
当我遍历GitLab API文档进行提交(https://docs.gitlab.com/ee/api/commits.html)时,会有一个带有不同“属性”的表。您可以通过示例向我展示Attribute的用法吗? 例如:如何在上述curl命令中使用“自”属性?
答案 0 :(得分:0)
对于在那里寻找答案的人---> curl -X GET -H“ PRIVATE-TOKEN:tc5W6MZSREQb6XLCZx5-”“ http://192.168.8.200:8081/api/v4/projects/2/repository/commits/?ref_name=master&since=2019-06-12T00:00:00Z”