checkout a GitHub PR banch on normal pipeline

18 views
Skip to first unread message

Dan Tran

unread,
Apr 25, 2022, 7:34:22 PM4/25/22
to Jenkins Users
Hi

I have been searching for groovy solution to check out a GH PR to my Jenkins workspace,  so far none of the suggestions works [1]. 

Have anyone able to get this scenario it working?

Thanks

-D




John Patrick

unread,
Apr 26, 2022, 12:47:47 PM4/26/22
to jenkins...@googlegroups.com
To be clear, are you wanting;
1) github to trigger the job to run for that PR
2) jenkins job to detect PR and run job for that PR

John


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/984e6668-6422-4b95-9375-e4a74f2cc4f1n%40googlegroups.com.

Dan Tran

unread,
Apr 27, 2022, 2:49:25 PM4/27/22
to Jenkins Users
Hi John

Thanks for responding

I am looking for a snippet of Groovy code that can check out  a GH PR source. User will provide   repo url, credential, and PR#

-D

John Patrick

unread,
Apr 27, 2022, 5:09:32 PM4/27/22
to jenkins...@googlegroups.com
So this might be useful to push back to the build status to the PR https://plugins.jenkins.io/pipeline-gitstatuswrapper/

But regarding checking out, I think the standard git checkout would work, but use the source branch url instead of the pr for that. So, something like;
```
git branch: XXX
url: XXX,
credentialsId: XXX
```

As a PR is purely highlighting a specific source repo and branch combination.

Not sure if that helps or not.

John


Reply all
Reply to author
Forward
0 new messages