Its possible to cancel a build when a commit to PR comes in

We have the situation that we get a lot commits in PRs and this results in long queue of builds where only the last one needs to run. It would be good if a build can be canceled when a new commit is pushed to a PR. Any chance to do this, maybe a script or plugin?

Any help is appreciated, thanks in advance.

You could use webhooks combined with the Drone API to do something like this:

  1. Drone triggers webhooks to service (service is a program you create)
  2. Service receives webhook and filters webhooks with event == build and action == create
  3. Service uses the API to fetch a list of recent builds for the repository
  4. Service makes API calls to cancel pending pull request builds
1 Like

Thanks for the fast answer, sounds doable.

Support here is always great, thanks for being so responsible.

Took some time but I tried it and I am not sure if I made a mistake. I can’t see the webhook coming in and have not really a idea where to look now.

Here is what I did:

  • Added the


to the docker-compose.yml

  • Restartet drone server

  • I used as endpoint but also a local endpoint, I don’t recive data.

Has something changed or is there a place I can look further.