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

前端 未结 1 1733
天涯浪人
天涯浪人 2021-02-19 22:10

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 d

1条回答
  •  广开言路
    2021-02-19 22:58

    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

    0 讨论(0)
提交回复
热议问题