Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 230
alvas Avatar asked Oct 03 '18 05:10

alvas


1 Answers

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.

like image 53
Matthijs Avatar answered Oct 31 '22 08:10

Matthijs