I have configured a couple of github webhooks for working with my team:
The problem is with (2); After I create a new branch like below:
git checkout -b test master
git push -u origin test
both create
and push
hooks are triggered. However in this case I only need create
to be triggered. Is there something I am doing wrong here?
My hooks are the following:
{
"name": "web",
"active": true,
"events": [
"create"
],
"config": {
"url": "http://myurl/create",
"content_type": "json"
}
}
and
{
"name": "web",
"active": true,
"events": [
"push"
],
"config": {
"url": "http://myurl/push",
"content_type": "json"
}
}
Thanks
For anyone else out there wondering how to solve this:
It seems that the hook payload includes a created
field which tells you whether the ref was created as a result of the push. In other words if its value is true the push event was triggered as a result of the branch creation (that's how we push it to the remote anyway).
Otherwise it's just a plain code push.
Filter it on your end and you're good to go.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.