Webフックイベントリスト
- 印刷する
- PDF
Webフックイベントリスト
- 印刷する
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
Classic/VPC環境で利用できます。
Webフックに登録できるイベントは以下の通りです。
参考
- イベントタイプを選択すると、サブアクションはすべて検出されます。
- イベントタイプのサブアクションごとに選択できません。
注意
新規ブランチを作成した場合は、createイベントのみ発生し、pushイベントは発生しません。
イベントタイプ | 内容 | 下位アクション | アクション実行方法参考資料 |
---|---|---|---|
push | 1つ以上のコミットがリポジトリに push |
| Gitクライアントを使用する |
pull_request | Pull Request作業 |
| リポジトリ管理 - プルリクエストの使用 |
create | ブランチまたはタグの作成 |
| リポジトリ管理 - ブランチ管理 |
delete | ブランチまたはタグの削除 |
| リポジトリ管理 - ブランチ管理 |
meta | Webフックの削除 | N/A | Webフックの使用 - Webフックの削除 |
repository | リポジトリの属性変更 |
| リポジトリ管理 - リポジトリ設定変更 |
file_safer | File Safer悪性コード検査完了 |
| File Safer悪性コード検査 |
file_lock | (LFS)file lockを使用 |
| ファイルロック |
Webフック Payload構成
Webフック Payloadは、Webフック呼び出し時に伝達される実質的なデータです。
注意
- Payloadデータサイズが 65,535byteを超過する場合、正常な Webhook呼び出しができません。
- Content Typeが application/x-www-form-urlencodedに設定されている場合、request body内の'payload'keyに該当する valueに全体 Payloadデータが送信されます。
Webフック Payload形式
Webフック Payload構成形式は以下の通りです。event
キーに該当する部分はイベントタイプによって異なり、その他の version
, repository
, sender
, timestamp
は一定の形式です。
{
"version": <Webフックバージョン>,
"repository": {
"id": <リポジトリ id>,
"name": <リポジトリ名>,
"description": <リポジトリの説明>,
"ssh_url": <リポジトリ git sshアドレス>,
"https_url": <リポジトリ git httpsアドレス>,
"portaladdr": <リポジトリポータルアドレス>
"created_at": <作成日>,
"owner": <作成者>
},
"sender": <送信者情報>,
"event": {
"type": <イベントタイプ>
"payload": <イベント情報>
},
"timestamp": <時間情報>
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
version | string | SourceCommit Webフックバージョン | 現在の Webフックの最新バージョンは「v1」 |
repository.id | number | リポジトリ id値 | |
repository.name | string | リポジトリ名 | |
repository.description | string | リポジトリの説明 | |
repository.ssh_url | string | リポジトリ git sshアドレス | |
repository.https_url | string | リポジトリ git httpアドレス | |
repository.portaladdr | string | リポジトリポータルアドレス | |
repository.created_at | number | リポジトリ作成日 | timestamp |
repository.owner | string | リポジトリを作成したユーザー | |
sender | object | 送信者情報 | 参照: 送信者情報形式 |
event.type | string | イベントタイプ | 参照: Webフックイベント |
event.payload | object | イベント情報 | 参照: イベント別詳細 |
timestamp | number | Webフック発生時間 unix timestamp |
送信者情報形式
送信者(sender)情報の形式は次のとおりです。
http gitアドレスを使用してイベントが発生した場合
{ "mbrNo": <member-no>, "user_id": <user-id>, "id_no" : <id-No> }
ssh gitアドレスを使用してイベントが発生した場合
{ "mbrNo": <member-no>, "type": "Tenant" | "SubAccount", "user_id" : <user-id> // Provided only in case of subaccount }
file_saferイベントを使用する場合
{ "mbrNo": <member-no>, "type": "system", }
キー | タイプ | 説明 | 備考 |
---|---|---|---|
mbrNo | string | 顧客番号 | |
id_no | string | 顧客の識別値 | |
user_id | string | ユーザー id |
Payload全体例
event.type=createである場合の例です。
{
"version": "v1",
"repository": {
"id": 123456,
"name": "test-name",
"description": "test-description",
"ssh_url": "ssh://devtools.ncloud.com/test/test-repo.git",
"https_url": "https://devtools.ncloud.com/test/test-repo.git",
"portaladdr": "https://devtools.ncloud.com/test/test-repo",
"created_at": 1662524215000,
"owner": "test@sample.com"
},
"sender": {
"mbrNo": "123456789",
"id_no": "aaaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee",
"user_id": "test-user"
},
"timestamp": 1663208183206,
"event": {
"type": "create",
"payload": {
"ref": "refs/heads/<branch name>",
"type": "branch",
"name": <branch-name>,
"action": "created",
"before": "0000000000000000000000000000000000000000",
"after": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
"sender": {
"protocol": "https",
"user_id": <user id>,
"id_no": <id-no>
},
"head_commit": [
{
"hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
"tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
"parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
"timestamp": "1655899275",
"author": {
"author_name": <author name>
},
"committer": {
"committer_name": <committer name>
},
"commit_message": <commit message>
}
]
}
}
}
イベント別詳細情報
イベントタイプによって変わるウェブフック Payload内の event形式について説明します。
pushイベント詳細説明および例
{
"type": "push",
"payload": {
"ref": "refs/heads/<branch name>",
"action": "commit",
"before": "c3b67b4527cb196da2195082794cca1643aa7bba",
"after": "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
"sender": {
"protocol": "https",
"user_id": <user id>,
"id_no": <id-no>
},
"head_commit": [
{
"hash_id": "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
"tree_id": "d038fe14f2da4ac2227b982a20891a32fb8ae99c",
"parent_hash_id": "71e03a954a845240b1944fdc93b9606adce98cc1",
"timestamp": "1655899919",
"author": {
"author_name": <author name>
},
"committer": {
"committer_name": <committer name>
},
"commit_message": <commit message>
}
],
"commits": [
{
"hash_id": "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
"tree_id": "d038fe14f2da4ac2227b982a20891a32fb8ae99c",
"parent_hash_id": "71e03a954a845240b1944fdc93b9606adce98cc1",
"timestamp": "1655899919",
"author": {
"author_name": <author name>
},
"committer": {
"committer_name": <committer name>
},
"commit_message": <commit message>
}
]
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "push" |
payload.ref | string | push対象 ref情報 | |
payload.action | string | 下位アクション | "commit" |
payload.before | string | 以前の sha値 | |
payload.after | string | 以後の sha値 | |
payload.sender | object | 送信者情報 |
|
payload.head_commit | array | pushされたコミットの head commit | |
payload.head_commit[*].hash_id | string | commitの hash_id | |
payload.head_commit[*].tree_id | string | commitの tree_id | |
payload.head_commit[*].parent_hash_id | string | commitの parent_hash_id | |
payload.head_commit[*].timestamp | string | commitの timestamp | |
payload.head_commit[*].author.author_name | string | commitの author_name | |
payload.head_commit[*].committer.committer_name | string | commitの committer_name | |
payload.commits | array | pushされた commitリスト | 最新のコミットメントが0番インデックスから開始 |
payload.commits[*].commit_message | string | commitの commit_message | |
payload.commits[*].hash_id | string | commitの hash_id | |
payload.commits[*].tree_id | string | commitの tree_id | |
payload.commits[*].parent_hash_id | string | commitの parent_hash_id | |
payload.commits[*].timestamp | string | commitの timestamp | |
payload.commits[*].author.author_name | string | commitの author_name | |
payload.commits[*].committer.committer_name | string | commitの committer_name | |
payload.commits[*].commit_message | string | commitの commit_message |
createイベント詳細説明および例
{
"type": "create",
"payload": {
"ref": "refs/heads/<branch name>",
"type": "branch",
"name": <branch-name>,
"action": "created",
"before": "0000000000000000000000000000000000000000",
"after": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
"sender": {
"protocol": "https",
"user_id": <user id>,
"id_no": <id-no>
},
"head_commit": [
{
"hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
"tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
"parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
"timestamp": "1655899275",
"author": {
"author_name": <author name>
},
"committer": {
"committer_name": <committer name>
},
"commit_message": <commit message>
}
]
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "create" |
payload.ref | string | push対象 ref情報 | |
payload.type | string | 配布対象のタイプ | "branch" or "tag" |
payload.action | string | 下位アクション | "created" |
payload.before | string | 以前の sha値 | |
payload.after | string | 以後の sha値 | |
payload.sender | object | 送信者情報 |
|
payload.head_commit | array | pushされたコミットの head commit | |
payload.head_commit[*].hash_id | string | commitの hash_id | |
payload.head_commit[*].tree_id | string | commitの tree_id | |
payload.head_commit[*].parent_hash_id | string | commitの parent_hash_id | |
payload.head_commit[*].timestamp | string | commitの timestamp | |
payload.head_commit[*].author.author_name | string | commitの author_name | |
payload.head_commit[*].committer.committer_name | string | commitの committer_name |
deleteイベント詳細説明および例
{
"type": "delete",
"payload": {
"ref": "refs/heads/<branch name>",
"type": "branch",
"name": <branch-name>,
"action": "deleted",
"before": "68ed6fc3e2cdf74af0fa1b3591ff593d1e28a4cb",
"after": "0000000000000000000000000000000000000000",
"sender": {
"protocol": "https",
"user_id": <user id>,
"id_no": <id-no>
},
"head_commit": [
{
"hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
"tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
"parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
"timestamp": "1655899275",
"author": {
"author_name": <author name>
},
"committer": {
"committer_name": <committer name>
},
"commit_message": <commit message>
}
]
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "delete" |
payload.ref | string | push対象 ref情報 | |
payload.type | string | 配布対象のタイプ | "branch" or "tag" |
payload.action | string | 下位アクション | "deleted" |
payload.before | string | 以前の sha値 | |
payload.after | string | 以後の sha値 | |
payload.sender | object | 送信者情報 | |
payload.head_commit | array | pushされたコミットの head commit | |
payload.head_commit[*].hash_id | string | commitの hash_id | |
payload.head_commit[*].tree_id | string | commitの tree_id | |
payload.head_commit[*].parent_hash_id | string | commitの parent_hash_id | |
payload.head_commit[*].timestamp | string | commitの timestamp | |
payload.head_commit[*].author.author_name | string | commitの author_name | |
payload.head_commit[*].committer.committer_name | string | commitの committer_name |
pull_requestイベント詳細説明および例
{
"type": "pull_request",
"payload": {
"action": "opened" | "closed" | "merged" | "edited" | "updated_head",
"pull_request_number": 10,
"pull_request_title": <pull request name>,
"pull_request_description": <pull request description>,
"auto_merge_enable": true,
"from": {
"branch": "sub",
"sha": <sha>
},
"to": {
"branch": "master",
"sha": <sha>
},
"sender": {
"user_id": <user id>
},
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "pull_request" |
payload.action | string | 下位アクション |
|
payload.pull_request_number | number | プルリクエストの番号 | |
payload.pull_request_title | string | プルリクエストの題名 | |
payload.pull_request_description. | string | プルリクエストの説明 | |
payload.auto_merge_enable | boolean | コンフリクトなしに併合可能かどうか | payload.actionが 「opened」と「updated_head」である場合のみ提供 |
from.branch | string | fromブランチ名 | |
from.sha | string | Fromブランチの sha値 | |
to.branch | string | toブランチ名 | |
to.sha | string | toブランチの sha値 | |
sender.user_id | string | ユーザー id値 |
metaイベント詳細説明および例
{
"type": "meta",
"payload": {
"webhook": {
"id": <webhook id>,
"name": <webhook name>
}
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "meta" |
payload.webhook.id | number | webhook id値 | |
payload.webhook.name | string | webhook名 |
repositoryイベント詳細説明および例
{
"type": "repository",
"payload": {
"action": "edited",
"sender": {
"user_id": <user id>
},
"before": {
"description": "before description",
"file_safer": true
},
"after": {
"description": "after description",
"file_safer": false
}
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "repository" |
payload.action | string | 下位アクション | "edited" |
payload.sender.user_id | string | ユーザー id | |
payload.before.description | string | 編集前のリポジトリ説明 | |
payload.before.file_safer | boolean | 編集前に file saferを使用するかどうか | |
payload.after.description | string | 編集後のリポジトリ説明 | |
payload.after.file_safer | boolean | 編集後、file saferを使用するかどうか |
file_saferイベント詳細説明および例
{
"type": "file_safer",
"payload": {
"target_hash": "123456117f77a541bdcb68d36234dbb317c7f1f7",
"action": "done",
"total_file_count": 1,
"infected_file_count": 0,
"request_date": "2022-09-14T11:24:28.000Z",
"complete_date": "2022-09-14T11:24:40.000Z"
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "file_safer" |
payload.target_hash | string | ターゲットのハッシュ値 | |
payload.action | string | 下位アクション | done |
payload.total_file_count | number | ファイル総検査数 | |
payload.infected_file_count | number | 悪性ファイルの総数 | |
payload.request_date | string | ファイル検査所要時間 | |
payload.complete_date | string | ファイル検査完了時間 |
file_lockイベント詳細説明および例
{
"type": "file_lock",
"payload": {
"action": "create",
"sender": {
"user_id": <user id>
},
"path": "file.txt",
"locked_time": "2022-01-01 00:00:00.00",
"unlocked_time": "2022-01-01 00:00:00.00"
}
}
キー | タイプ | 説明 | 備考 |
---|---|---|---|
type | string | イベントタイプ | "file_lock" |
payload.action | string | 下位アクション |
|
payload.sender.user_id | string | ユーザー id | |
path | string | ファイル経路 | |
locked_time | string | lockが行われた時間 | actionが createの場合にのみ提供 |
unlocked_time | string | unlockが行われた時間 | actionが deleteの場合にのみ提供 |
この記事は役に立ちましたか?