API for Cancelling a Merge after a user clicked the "Merge" button


Hi all!

We have a customer that want to integrate Applitools and GitHub.
Applitools is a visual testing platform that, just like git, supports branches and merges.

The flow is as follows:

  1. The customer pushes a change of code to a GitHub branch.
  2. A PR notification event is fired by GitHub and caught by a CI app or service (for example - Travis)
  3. The CI sends a status message to GitHub, which distributes it to all listeners.
  4. Our GitHub App (Applitools) catches that status event, and sends a commit status of its own, based on the current test status.
  5. When all is done, GitHub shows a “Merge” button (for protected branches this button is locked until all statuses are “passed”).
  6. The user clicks the Merge button.
  7. GitHub merges the code and sends a PR event with status “closed” and “merged:true”.
  8. Our GitHub App (Applitools) tries to merge its local branches accordingly.

And my question is: What can I do if the local (Applitools) merge fails? Can I revert the GitHub merge? Is there a way to postpone the merge until another app tries to do something?

This is very important to us, so any help will be welcomed.