Skip to content

how to reference nested payload value #73

@iscaswang

Description

@iscaswang

my gitlab webhook receives merge request payload like this:

{
"id": 59259,
"target_branch": "master",
"source_branch": "feature/ccc/ci_test",
"source_project_id": 14904,
"author_id": 6205,
"assignee_id": 6205,
"title": "Feature/ccc/ci test",
"created_at": "2017-09-11T08:41:57+0000",
"updated_at": "2017-09-11T08:41:57+0000",
"st_commits": null,
"st_diffs": null,
"milestone_id": null,
"state": "opened",
"merge_status": "unchecked",
"target_project_id": 14904,
"iid": 693,
"description": "test",
"source": {
"name": "backend",
"ssh_url": "git@git.code.oa.com:mmad_delivery/backend.git",
"http_url": "http://git.code.oa.com/mmad_delivery/backend.git",
"web_url": "http://git.code.oa.com/mmad_delivery/backend",
"namespace": "mmad_delivery",
"visibility_level": 0
},
"target": {
"name": "backend",
"ssh_url": "git@git.code.oa.com:mmad_delivery/backend.git",
"http_url": "http://git.code.oa.com/mmad_delivery/backend.git",
"web_url": "http://git.code.oa.com/mmad_delivery/backend",
"namespace": "mmad_delivery",
"visibility_level": 0
},
"last_commit": {
"id": "1c791ccdcdc22c8f070d6ad5e3b3afb79a6d7757",
"message": "commit 4\n",
"timestamp": "2017-09-11T11:33:46+0000",
"url": "http://git.code.oa.com/mmad_delivery/backend/commits/1c791ccdcdc22c8f070d6ad5e3b3afb79a6d7757",
"author": {
"name": "ccc",
"email": "ccc@163.com"
}
},
"url": "http://git.code.oa.com/mmad_delivery/backend/merge_requests/693",
"action": "open"
}

now i want to get the last message via environment variable last_commit.message in my shell, and I already parameterized this variable, but in fact i can only get the default value for the variable, so what is the corrent method to get the last commit message value from payload? many thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions