Don't merge (or revert) if tests fails

Hello guys!

I’m trying to configure CI on my Node.js app but the “normal use case” doesn’t fit my model.

Normal use case:

  1. You do a PR.
  2. PR is approved and merge is done.
  3. If tests pass, a build is made.

The thing is that in my case a merge is a build, that is because my production server is always doing a pull of the last changes and Node.js code doesn’t compile.

My possible solutions:

  1. If tests fails, do a reverse of the merge.
  2. Run tests on PR and approve the merge if tests pass (is this possible?).

What do you think? Any other ideas?