- リポジトリのコミット一覧
- 複数のファイルとアクションを含むコミットを作成
- 単一のコミットを取得
- にプッシュされたコミットへの参照を取得します。
- チェリーピックでコミット
- コミットの取り消し
- コミットの差分を取得
- コミットのコメントを取得
- コミットにコメントを投稿
- コミットのディスカッションを取得
- コミット状況
- コミットに関連するマージリクエストを一覧表示します。
- コミットのGPG署名を取得
コミットAPI
リポジトリのコミット一覧
プロジェクト内のリポジトリコミットの一覧を取得します。
GET /projects/:id/repository/commits
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
ref_name
| 列 | いいえ | リポジトリのブランチ、タグ、またはリビジョン範囲の名前。 |
since
| 列 | いいえ | この日付以降またはこの日付のコミットのみが ISO 8601 形式 YYYY-MM-DDTHH:MM:SSZ で返されます。 |
until
| 列 | いいえ | この日付より前またはこの日付のコミットのみが ISO 8601 形式の YYYY-MM-DDTHH:MM:SSZ で返されます。 |
path
| 列 | いいえ | ファイルパス |
all
| ブーリアン | いいえ | リポジトリからすべてのコミットを取得します。 |
with_stats
| ブーリアン | いいえ | 各コミットに関する統計がレスポンスに追加されます。 |
first_parent
| ブーリアン | いいえ | マージコミットを見て、最初の親コミットだけを追います。 |
order
| 列 | いいえ | 可能な値:default ,topo . デフォルトはdefault で、コミットは時系列順に表示されます。
|
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/commits"
回答例
[
{
"id": "ed899a2f4b50b4370feeea94676502b42383c746",
"short_id": "ed899a2f4b5",
"title": "Replace sanitize with escape once",
"author_name": "Example User",
"author_email": "user@example.com",
"authored_date": "2012-09-20T11:50:22+03:00",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2012-09-20T11:50:22+03:00",
"created_at": "2012-09-20T11:50:22+03:00",
"message": "Replace sanitize with escape once",
"parent_ids": [
"6104942438c14ec7bd21c6cd5bd995272b3faff6"
],
"web_url": "https://gitlab.example.com/thedude/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746"
},
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
"short_id": "6104942438c",
"title": "Sanitize for network graph",
"author_name": "randx",
"author_email": "user@example.com",
"committer_name": "ExampleName",
"committer_email": "user@example.com",
"created_at": "2012-09-20T09:06:12+03:00",
"message": "Sanitize for network graph",
"parent_ids": [
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"web_url": "https://gitlab.example.com/thedude/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746"
}
]
複数のファイルとアクションを含むコミットを作成
GitLab 8.13 で導入されました。
JSONペイロードを投稿してコミットを作成します。
POST /projects/:id/repository/commits
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス |
branch
| 列 | はい | コミットするブランチの名前。 新しいブランチを作成するには、start_branch またはstart_sha のどちらか、そしてオプションでstart_project も指定します。
|
commit_message
| 列 | はい | コミットメッセージ |
start_branch
| 列 | いいえ | 新しいブランチを開始するブランチ名 |
start_sha
| 列 | いいえ | から新しいブランチを開始するコミットの SHA。 |
start_project
| 整数/文字列 | いいえ | 新しいブランチを開始するプロジェクトのプロジェクト ID あるいはURL エンコードされたパス。 デフォルト値はid です。
|
actions[]
| アレイ | はい | バッチとしてコミットするアクションハッシュの配列。 どのような属性をとるかは次の表を参照ください。 |
author_email
| 列 | いいえ | コミット作成者のメールアドレスを指定します。 |
author_name
| 列 | いいえ | コミット作成者名の指定 |
stats
| ブーリアン | いいえ | コミットの統計情報を含める デフォルトはtrue |
force
| ブーリアン | いいえ |
true がターゲットブランチを新しいコミットで上書きする際に、start_branch あるいはstart_sha
|
actions[] 属性
| タイプ | 必須 | 説明 |
---|---|---|---|
action
| 列 | はい | 実行するアクション、create 、delete 、move 、update 、chmod
|
file_path
| 列 | はい | ファイルのフルパス。lib/class.rb
|
previous_path
| 列 | いいえ | 例:lib/class1.rb .move アクションでのみ考慮されます。
|
content
| 列 | いいえ |
delete 、chmod 、move を除くすべてで必要です。指定しない移動アクションはcontent 既存のファイル内容を保持し、その他の値を content 指定するとファイル内容が上書きされます。
|
encoding
| 列 | いいえ |
text またはbase64 .text がデフォルト。
|
last_commit_id
| 列 | いいえ | 更新、移動、削除アクションでのみ考慮されます。 |
execute_filemode
| ブーリアン | いいえ |
true/false 、ファイルの実行フラグを有効/無効にします。chmod アクションでのみ考慮されます。
|
PAYLOAD=$(cat << 'JSON'
{
"branch": "master",
"commit_message": "some commit message",
"actions": [
{
"action": "create",
"file_path": "foo/bar",
"content": "some content"
},
{
"action": "delete",
"file_path": "foo/bar2"
},
{
"action": "move",
"file_path": "foo/bar3",
"previous_path": "foo/bar4",
"content": "some content"
},
{
"action": "update",
"file_path": "foo/bar5",
"content": "new content"
},
{
"action": "chmod",
"file_path": "foo/bar5",
"execute_filemode": true
}
]
}
JSON
)
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --header "Content-Type: application/json" --data "$PAYLOAD" "https://gitlab.example.com/api/v4/projects/1/repository/commits"
回答例
{
"id": "ed899a2f4b50b4370feeea94676502b42383c746",
"short_id": "ed899a2f4b5",
"title": "some commit message",
"author_name": "Example User",
"author_email": "user@example.com",
"committer_name": "Example User",
"committer_email": "user@example.com",
"created_at": "2016-09-20T09:26:24.000-07:00",
"message": "some commit message",
"parent_ids": [
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"committed_date": "2016-09-20T09:26:24.000-07:00",
"authored_date": "2016-09-20T09:26:24.000-07:00",
"stats": {
"additions": 2,
"deletions": 2,
"total": 4
},
"status": null,
"web_url": "https://gitlab.example.com/thedude/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746"
}
GitLab はフォームエンコーディングに対応しています。 以下は Commit API をフォームエンコーディングで使用する例です:
curl --request POST \
--form "branch=master" \
--form "commit_message=some commit message" \
--form "start_branch=master" \
--form "actions[][action]=create" \
--form "actions[][file_path]=foo/bar" \
--form "actions[][content]=</path/to/local.file" \
--form "actions[][action]=delete" \
--form "actions[][file_path]=foo/bar2" \
--form "actions[][action]=move" \
--form "actions[][file_path]=foo/bar3" \
--form "actions[][previous_path]=foo/bar4" \
--form "actions[][content]=</path/to/local1.file" \
--form "actions[][action]=update" \
--form "actions[][file_path]=foo/bar5" \
--form "actions[][content]=</path/to/local2.file" \
--form "actions[][action]=chmod" \
--form "actions[][file_path]=foo/bar5" \
--form "actions[][execute_filemode]=true" \
--header "PRIVATE-TOKEN: <your_access_token>" \
"https://gitlab.example.com/api/v4/projects/1/repository/commits"
単一のコミットを取得
コミットハッシュやブランチ名、タグ名で指定したコミットを取得します。
GET /projects/:id/repository/commits/:sha
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | リポジトリのブランチやタグのコミットハッシュや名前 |
stats
| ブーリアン | いいえ | コミットの統計情報を含める デフォルトはtrue |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/commits/master"
回答例
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
"short_id": "6104942438c",
"title": "Sanitize for network graph",
"author_name": "randx",
"author_email": "user@example.com",
"committer_name": "Dmitriy",
"committer_email": "user@example.com",
"created_at": "2012-09-20T09:06:12+03:00",
"message": "Sanitize for network graph",
"committed_date": "2012-09-20T09:06:12+03:00",
"authored_date": "2012-09-20T09:06:12+03:00",
"parent_ids": [
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"last_pipeline" : {
"id": 8,
"ref": "master",
"sha": "2dc6aa325a317eda67812f05600bdf0fcdc70ab0",
"status": "created"
},
"stats": {
"additions": 15,
"deletions": 10,
"total": 25
},
"status": "running",
"web_url": "https://gitlab.example.com/thedude/gitlab-foss/-/commit/6104942438c14ec7bd21c6cd5bd995272b3faff6"
}
にプッシュされたコミットへの参照を取得します。
GitLab 10.6 で導入されました。
コミットがプッシュされたすべての参照 (ブランチあるいはタグから) を取得します。 pagination パラメータpage
およびper_page
を使用して、参照の一覧を制限することができます。
GET /projects/:id/repository/commits/:sha/refs
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | コミットハッシュ |
type
| 列 | いいえ | コミットのスコープ。指定可能な値branch ,tag ,all . デフォルトは . all
|
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/commits/5937ac0a7beb003549fc5fd26fc247adbce4a52e/refs?type=all"
回答例
[
{"type": "branch", "name": "'test'"},
{"type": "branch", "name": "add-balsamiq-file"},
{"type": "branch", "name": "wip"},
{"type": "tag", "name": "v1.1.0"}
]
チェリーピックでコミット
GitLab 8.15で導入されました。
指定したブランチへのコミットを cherry-pick します。
POST /projects/:id/repository/commits/:sha/cherry_pick
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | コミットハッシュ |
branch
| 列 | はい | ブランチの名前 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "branch=master" "https://gitlab.example.com/api/v4/projects/5/repository/commits/master/cherry_pick"
回答例
{
"id": "8b090c1b79a14f2bd9e8a738f717824ff53aebad",
"short_id": "8b090c1b",
"title": "Feature added",
"author_name": "Example User",
"author_email": "user@example.com",
"authored_date": "2016-12-12T20:10:39.000+01:00",
"created_at": "2016-12-12T20:10:39.000+01:00",
"committer_name": "Administrator",
"committer_email": "admin@example.com",
"committed_date": "2016-12-12T20:10:39.000+01:00",
"title": "Feature added",
"message": "Feature added\n\nSigned-off-by: Example User <user@example.com>\n",
"parent_ids": [
"a738f717824ff53aebad8b090c1b79a14f2bd9e8"
],
"web_url": "https://gitlab.example.com/thedude/gitlab-foss/-/commit/8b090c1b79a14f2bd9e8a738f717824ff53aebad"
}
cherry-pickに失敗したイベントには、その理由を説明します:
{
"message": "Sorry, we cannot cherry-pick this commit automatically. This commit may already have been cherry-picked, or a more recent commit may have updated some of its content.",
"error_code": "empty"
}
この場合、チェンジセットが空であったために cherry-pick が失敗し、ターゲットブランチにそのコミットがすでに存在していることを示しています。 他に考えられるエラーコードはconflict
で、これはマージが衝突したことを示しています。
コミットの取り消し
GitLab 11.5で導入されました。
指定したブランチのコミットを取り消します。
POST /projects/:id/repository/commits/:sha/revert
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | プロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | SHAをコミットして差し戻し |
branch
| 列 | はい | 対象ブランチ名 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "branch=master" "https://gitlab.example.com/api/v4/projects/5/repository/commits/a738f717824ff53aebad8b090c1b79a14f2bd9e8/revert"
回答例
{
"id":"8b090c1b79a14f2bd9e8a738f717824ff53aebad",
"short_id": "8b090c1b",
"title":"Revert \"Feature added\"",
"created_at":"2018-11-08T15:55:26.000Z",
"parent_ids":["a738f717824ff53aebad8b090c1b79a14f2bd9e8"],
"message":"Revert \"Feature added\"\n\nThis reverts commit a738f717824ff53aebad8b090c1b79a14f2bd9e8",
"author_name":"Administrator",
"author_email":"admin@example.com",
"authored_date":"2018-11-08T15:55:26.000Z",
"committer_name":"Administrator",
"committer_email":"admin@example.com",
"committed_date":"2018-11-08T15:55:26.000Z",
"web_url": "https://gitlab.example.com/thedude/gitlab-foss/-/commit/8b090c1b79a14f2bd9e8a738f717824ff53aebad"
}
リバートに失敗したイベントの場合、そのレスポンスにはその理由についてのコンテキストが記載されます:
{
"message": "Sorry, we cannot revert this commit automatically. This commit may already have been reverted, or a more recent commit may have updated some of its content.",
"error_code": "conflict"
}
この場合、差し戻しがマージ競合を発生させたため、差し戻しに失敗したことになります。 他に考えられるエラーコードはempty
で、これはチェンジセットが空であったことを示します。
コミットの差分を取得
プロジェクト内のコミットの diff を取得します。
GET /projects/:id/repository/commits/:sha/diff
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | リポジトリのブランチやタグのコミットハッシュや名前 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/commits/master/diff"
回答例
[
{
"diff": "--- a/doc/update/5.4-to-6.0.md\n+++ b/doc/update/5.4-to-6.0.md\n@@ -71,6 +71,8 @@\n sudo -u git -H bundle exec rake migrate_keys RAILS_ENV=production\n sudo -u git -H bundle exec rake migrate_inline_notes RAILS_ENV=production\n \n+sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production\n+\n ```\n \n ### 6. Update config files",
"new_path": "doc/update/5.4-to-6.0.md",
"old_path": "doc/update/5.4-to-6.0.md",
"a_mode": null,
"b_mode": "100644",
"new_file": false,
"renamed_file": false,
"deleted_file": false
}
]
コミットのコメントを取得
プロジェクト内のコミットのコメントを取得します。
GET /projects/:id/repository/commits/:sha/comments
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | リポジトリのブランチやタグのコミットハッシュや名前 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/commits/master/comments"
回答例
[
{
"note": "this code is really nice",
"author": {
"id": 11,
"username": "admin",
"email": "admin@local.host",
"name": "Administrator",
"state": "active",
"created_at": "2014-03-06T08:17:35.000Z"
}
}
]
コミットにコメントを投稿
コミットにコメントを追加します。
特定のファイルの特定の行にコメントを投稿するには、完全なコミットSHA、path
、line
、line_type
を指定する必要がありますnew
。
コメントは、以下のケースのうち少なくとも1つが有効であれば、最後のコミットの最後に追加されます:
-
sha
はブランチまたはタグであり、line
またはpath
は無効です。 -
line
の番号が無効です(存在しません)。 -
path
が無効(存在しない)。
上記のいずれの場合も、line
、line_type
、path
の応答は、null
に設定されます。
POST /projects/:id/repository/commits/:sha/comments
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | リポジトリのブランチやタグのコミット SHA や名前 |
note
| 列 | はい | コメント本文 |
path
| 列 | いいえ | リポジトリからの相対ファイルパス |
line
| 整数 | いいえ | コメントを配置する行番号 |
line_type
| 列 | いいえ |
new またはold を引数にとります。
|
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" --form "note=Nice picture man\!" --form "path=dudeism.md" --form "line=11" --form "line_type=new" "https://gitlab.example.com/api/v4/projects/17/repository/commits/18f3e63d05582537db6d183d9d557be09e1f90c8/comments"
回答例
{
"author" : {
"web_url" : "https://gitlab.example.com/thedude",
"avatar_url" : "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png",
"username" : "thedude",
"state" : "active",
"name" : "Jeff Lebowski",
"id" : 28
},
"created_at" : "2016-01-19T09:44:55.600Z",
"line_type" : "new",
"path" : "dudeism.md",
"line" : 11,
"note" : "Nice picture man!"
}
コミットのディスカッションを取得
プロジェクト内のコミットのディスカッションを取得します。
GET /projects/:id/repository/commits/:sha/discussions
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | リポジトリのブランチやタグのコミットハッシュや名前 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/commits/4604744a1c64de00ff62e1e8a6766919923d2b41/discussions"
回答例
[
{
"id": "4604744a1c64de00ff62e1e8a6766919923d2b41",
"individual_note": true,
"notes": [
{
"id": 334686748,
"type": null,
"body": "I'm the Dude, so that's what you call me.",
"attachment": null,
"author" : {
"id" : 28,
"name" : "Jeff Lebowski",
"username" : "thedude",
"web_url" : "https://gitlab.example.com/thedude",
"state" : "active",
"avatar_url" : "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png"
},
"created_at": "2020-04-30T18:48:11.432Z",
"updated_at": "2020-04-30T18:48:11.432Z",
"system": false,
"noteable_id": null,
"noteable_type": "Commit",
"resolvable": false,
"confidential": null,
"noteable_iid": null,
"commands_changes": {}
}
]
}
]
コミット状況
GitLab 8.1以降、これは新しいコミットステータスAPIです。
コミットのステータスを一覧表示
プロジェクト内のコミットのステータスを一覧表示します。 pagination パラメータpage
とper_page
を使用して、参照の一覧を制限することができます。
GET /projects/:id/repository/commits/:sha/statuses
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | コミットSHA |
ref
| 列 | いいえ | リポジトリのブランチまたはタグの名前、あるいは省略した場合はデフォルトのブランチ名 |
stage
| 列 | いいえ |
ビルドステージでフィルタリングします、test
|
name
| 列 | いいえ | ジョブ名でフィルタします、bundler:audit
|
all
| ブーリアン | いいえ | 最新のステータスだけでなく、すべてのステータスを返します。 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/17/repository/commits/18f3e63d05582537db6d183d9d557be09e1f90c8/statuses
回答例
[
...
{
"status" : "pending",
"created_at" : "2016-01-19T08:40:25.934Z",
"started_at" : null,
"name" : "bundler:audit",
"allow_failure" : true,
"author" : {
"username" : "thedude",
"state" : "active",
"web_url" : "https://gitlab.example.com/thedude",
"avatar_url" : "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png",
"id" : 28,
"name" : "Jeff Lebowski"
},
"description" : null,
"sha" : "18f3e63d05582537db6d183d9d557be09e1f90c8",
"target_url" : "https://gitlab.example.com/thedude/gitlab-foss/builds/91",
"finished_at" : null,
"id" : 91,
"ref" : "master"
},
{
"started_at" : null,
"name" : "test",
"allow_failure" : false,
"status" : "pending",
"created_at" : "2016-01-19T08:40:25.832Z",
"target_url" : "https://gitlab.example.com/thedude/gitlab-foss/builds/90",
"id" : 90,
"finished_at" : null,
"ref" : "master",
"sha" : "18f3e63d05582537db6d183d9d557be09e1f90c8",
"author" : {
"id" : 28,
"name" : "Jeff Lebowski",
"username" : "thedude",
"web_url" : "https://gitlab.example.com/thedude",
"state" : "active",
"avatar_url" : "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png"
},
"description" : null
},
...
]
ビルド状況をコミットに投稿
コミットのビルドステータスを追加または更新します。
POST /projects/:id/statuses/:sha
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | コミットSHA |
state
| 列 | はい |
pending ,running ,success ,failed のいずれか、canceled
|
ref
| 列 | いいえ | ステータスが参照するref (ブランチまたはタグ)
|
name またはcontext
| 列 | いいえ | このステータスを他のシステムのステータスと区別するためのラベル。 デフォルト値はdefault
|
target_url
| 列 | いいえ | このステータスに関連付ける対象の URL |
description
| 列 | いいえ | ステータスの簡単な説明 |
coverage
| フロート | いいえ | 総コードカバレッジ |
pipeline_id
| 整数 | いいえ | ステータスを設定するパイプラインのID。 同じSHAに複数のパイプラインがある場合に使用します。 |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/17/statuses/18f3e63d05582537db6d183d9d557be09e1f90c8?state=success"
回答例
{
"author" : {
"web_url" : "https://gitlab.example.com/thedude",
"name" : "Jeff Lebowski",
"avatar_url" : "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png",
"username" : "thedude",
"state" : "active",
"id" : 28
},
"name" : "default",
"sha" : "18f3e63d05582537db6d183d9d557be09e1f90c8",
"status" : "success",
"coverage": 100.0,
"description" : null,
"id" : 93,
"target_url" : null,
"ref" : null,
"started_at" : null,
"created_at" : "2016-01-19T09:05:50.355Z",
"allow_failure" : false,
"finished_at" : "2016-01-19T09:05:50.365Z"
}
コミットに関連するマージリクエストを一覧表示します。
GitLab 10.7から導入されました。
指定したコミットに関連するマージリクエストの一覧を取得します。
GET /projects/:id/repository/commits/:sha/merge_requests
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | コミットSHA |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/repository/commits/af5b13261899fb2c0db30abdd0af8b07cb44fdc5/merge_requests"
回答例
[
{
"id":45,
"iid":1,
"project_id":35,
"title":"Add new file",
"description":"",
"state":"opened",
"created_at":"2018-03-26T17:26:30.916Z",
"updated_at":"2018-03-26T17:26:30.916Z",
"target_branch":"master",
"source_branch":"test-branch",
"upvotes":0,
"downvotes":0,
"author" : {
"web_url" : "https://gitlab.example.com/thedude",
"name" : "Jeff Lebowski",
"avatar_url" : "https://gitlab.example.com/uploads/user/avatar/28/The-Big-Lebowski-400-400.png",
"username" : "thedude",
"state" : "active",
"id" : 28
},
"assignee":null,
"source_project_id":35,
"target_project_id":35,
"labels":[ ],
"work_in_progress":false,
"milestone":null,
"merge_when_pipeline_succeeds":false,
"merge_status":"can_be_merged",
"sha":"af5b13261899fb2c0db30abdd0af8b07cb44fdc5",
"merge_commit_sha":null,
"squash_commit_sha":null,
"user_notes_count":0,
"discussion_locked":null,
"should_remove_source_branch":null,
"force_remove_source_branch":false,
"web_url":"http://https://gitlab.example.com/root/test-project/merge_requests/1",
"time_stats":{
"time_estimate":0,
"total_time_spent":0,
"human_time_estimate":null,
"human_total_time_spent":null
}
}
]
コミットのGPG署名を取得
コミットが署名されている場合は、そのコミットから GPG 署名を取得します。 署名されていないコミットの場合は、404 レスポンスとなります。
GET /projects/:id/repository/commits/:sha/signature
パラメーター
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数/文字列 | はい | 認証されたユーザーが所有するプロジェクトのIDまたはURLエンコードされたパス |
sha
| 列 | はい | リポジトリのブランチやタグのコミットハッシュや名前 |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/repository/commits/da738facbc19eb2fc2cef57c49be0e6038570352/signature"
コミットが GPG 署名されている場合の応答例:
{
"signature_type": "PGP",
"verification_status": "verified",
"gpg_key_id": 1,
"gpg_key_primary_keyid": "8254AAB3FBD54AC9",
"gpg_key_user_name": "John Doe",
"gpg_key_user_email": "johndoe@example.com",
"gpg_key_subkey_id": null
}
コミットが X.509 で署名されている場合の応答例:
{
"signature_type": "X509",
"verification_status": "unverified",
"x509_certificate": {
"id": 1,
"subject": "CN=gitlab@example.org,OU=Example,O=World",
"subject_key_identifier": "BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC:BC",
"email": "gitlab@example.org",
"serial_number": 278969561018901340486471282831158785578,
"certificate_status": "good",
"x509_issuer": {
"id": 1,
"subject": "CN=PKI,OU=Example,O=World",
"subject_key_identifier": "AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB:AB",
"crl_url": "http://example.com/pki.crl"
}
}
}
コミットが符号なしの場合の応答例:
{
"message": "404 GPG Signature Not Found"
}