how to reject a pull request if tests are failed github actions

不打扰是莪最后的温柔 提交于 2020-12-05 02:43:06

问题


I am doing npm test when pull requests are raised using Github actions . Now if tests fails , I would like to add a message or at least reject the PR using actions.. How can i do it?


回答1:


I assume you have an on: pull_request workflow that runs npm test. This should automatically create a GitHub Check on the pull request that will fail if your tests fail. The best way to "reject" the pull request is to prevent it from being merged unless the tests pass. You can do this by turning on a setting in your repository to "Require status checks to pass before merging," and selecting your workflow as required.

You can find this setting under your repository's Settings > Branches.

There are further details about these settings in the documentation. https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks



来源:https://stackoverflow.com/questions/58654530/how-to-reject-a-pull-request-if-tests-are-failed-github-actions

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