Create a GitHub webhook for when a pull request is accepted & merged to master

自作多情 提交于 2019-12-02 17:26:41

So, you can't customize the conditions of the trigger, but as LeGec mentions you can customize your code to only trigger when the Pull Request is merged.

To do that, make sure your script responds to the PullRequestEvent. The conditions to test are:

  • "action" is "closed"
  • "merged" (inside of "pull_request") is true

This way your script can ignore all the pings it receives when any other activity occurs on the Pull Request (including closing without merging).

I don't see any way to customize the conditions of the trigger.

I would suggest to rather write code on the receiving end to trigger your action only when you detect that the push fits your conditions, e.g :

  • payload.ref == "refs/head/master"
  • payload.commits[0] matches the structure of a merged pull request (<- this may require getting some extra info from the commits API)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!