ghprb icon indicating copy to clipboard operation
ghprb copied to clipboard

Detect when Pull Requests have been closed

Open mig5 opened this issue 9 years ago • 18 comments

Hello,

Is it possible for Jenkins to detect when a Github Pull Request has been closed, when using the polling method (not Github hooks).

My aim is to detect when a Pull Request has been closed and therefore execute a task accordingly (e.g cleanup on a test server to remove a Docker instance related to that previously-open Pull Request).

As far as I can tell, the 'status' of a Pull Request is not exposed as an Environment variable?

Thanks

mig5 avatar Feb 05 '16 02:02 mig5

Currently the trigger only polls open PRs, and if the plugin comtains a reference that isnt in that list it removes it internally. So you are wanting the job to be triggered when we have determined that the PR is no longer open, and I am thinking this would beed to be an optional setting that defaults to off.

DavidTanner avatar Feb 05 '16 12:02 DavidTanner

Yes - basically require 2 things:

  1. an optional checkbox 'trigger on "closed" or "merged" event?' (so that my job will still fire)
  2. pass that pull request state (open, closed or merged) as an environment variable (so my job can conditionally perform a different action (destroy/cleanup) if the state is no longer open)

That would be awesome.

Thanks!

mig5 avatar Feb 07 '16 21:02 mig5

Agree with requester Would be awesome to get triggering on PR close, because in this case we are going to run server cleaner task to remove old builds data out of server. Any help will be appreciated

podarok avatar Jul 28 '16 08:07 podarok

+1

st4nson avatar Dec 29 '16 10:12 st4nson

I am also looking for same solution. Please let me know if anyone find it.

jayeshkhairnar avatar Nov 06 '17 06:11 jayeshkhairnar

+1

slavik57 avatar Nov 09 '17 22:11 slavik57

👍

truongleswe avatar Dec 01 '17 07:12 truongleswe

+1

eflamoe avatar Jan 02 '18 23:01 eflamoe

+1

ghost avatar Jan 08 '18 05:01 ghost

Using "GitHub hook trigger for GITScm polling" Build Triggers you can trigger Jenkins job once PR merge or closed.

jayeshkhairnar avatar Jan 08 '18 05:01 jayeshkhairnar

+1

AndreiF8 avatar Feb 21 '18 17:02 AndreiF8

+1

pperzyna avatar Mar 11 '18 19:03 pperzyna

+1

MichalPloski avatar Mar 13 '18 10:03 MichalPloski

+1

kevlam avatar Mar 26 '18 20:03 kevlam

+1

giorgenes avatar May 07 '18 00:05 giorgenes

+1

vandammeb avatar Jul 18 '18 17:07 vandammeb

+1

AhsanRiyad avatar Jan 17 '23 03:01 AhsanRiyad

Is there any update on this?

mfarag1 avatar Sep 21 '23 18:09 mfarag1