Github Pull Request Checks

坚强是说给别人听的谎言 提交于 2019-12-19 03:38:12

问题


Is it possible to create a Github Check for pull requests? I know there are WebHooks, but is there a way to also hook into the UI?

Aim:

  • Pull Request made. Perform validation and update pull request if valid.

  • Pull Request merged. Create web call to URL. Update Github issue with confirmation.

What's the best way to do this? Is it only via Web Hooks, API calls and getting write oAuth credentials?


回答1:


I know there are WebHooks, but is there a way to also hook into the UI?

The recommended way of doing this is to use required status checks and the Status API, in combination with webhooks:

https://help.github.com/articles/about-required-status-checks/

https://developer.github.com/v3/repos/statuses/

Users set up required status checks on the repository so that merging a pull request is blocked if a specific status isn't success.

At the same time, webhooks trigger an external process when a pull request is updated, and that process creates statuses based on the output of that process. If the process completes successfully, then the process should create a success status which will be shown in the UI and unblock the merging of the pull request.

Is it only via Web Hooks, API calls and getting write oAuth credentials?

In order to create statuses, you will indeed need to authenticate with the credentials of a user that has push access to the repository (e.g. via a token from that user with the right scopes).




回答2:


Note: you now (August 2018) officially have the notion of Checks

When checks are set up in a repository, pull requests have a Checks tab where you can view detailed build output from status checks and rerun failed checks.



来源:https://stackoverflow.com/questions/39043691/github-pull-request-checks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!