6

How to trigger a Travis rebuild for my pull-request from a github comment?

After a pull-request is created on Github, the Travis PR builds triggers. And if we want to re-trigger a build, we could press the Restart Job button on Travis GUI:

enter image description here

But is there a way to trigger the Restart Job by listening to the comments in the Github Pull-Request and perhaps look for a specific comment text, e.g. [CI: Restart build]?

In Jenkins with Cloudbees, it's possible to set the trigger phrase in the Build Triggers section, e.g.

enter image description here

Is that possible in Travis too?

How to trigger a Travis rebuild for my pull-request from a github comment?

Matthijs
  • 2,483
  • 5
  • 22
  • 33
alvas
  • 115,346
  • 109
  • 446
  • 738

1 Answers1

9

It doesn't seem to be possible from one side.

However, what you could try is to use GitHub Webhooks to listen for comments on Pull Requests. This could trigger a custom script on your server, which looks for commands inside a Pull Request comment (e.g. [CI: Restart build]).

If the pull request contains the command, you could then trigger a new build with the Travis API.

It may be some work to realize this, but this could be a nice workaround.

Matthijs
  • 2,483
  • 5
  • 22
  • 33