Access merged pull request in build#139
Conversation
|
@aaronjwhiteside or @aaronwalker, would you mind looking at this feature addition? It resolves what was discussed in #1. Let me know--thanks! |
|
Hello @aaronjwhiteside or @aaronwalker, could you please take a look at this change? Thank you! |
|
@l3ender let me take a look over the next couple of days. I need to get my head back into this change and the overall goal of the PR |
| uri.append('/').append(repoId); | ||
| uri.append("/pulls"); | ||
| uri.append("?state=").append("closed"); | ||
| uri.append("&sort=").append("updated"); | ||
| uri.append("&direction=").append("desc"); | ||
| uri.append("&per_page=").append("10"); // only need to check the most recently closed PRs |
There was a problem hiding this comment.
this is more ideal than searching the last 10 closed PRs
There was a problem hiding this comment.
I've updated and so far, seems to be working. I want to do a bit more testing, though--especially in a repo with a large number of PRs. Specifically, I'm not sure on this behavior:
If the commit is not present in the default branch, it will return merged and open pull requests associated with the commit.
That's definitely a valid scenario (PR is merged outside of the default branch, updating a branch and triggering a build), but I can't quite tell what it means for a pull request to be "associated with the commit" and so want to do a little deeper testing.
Will update here when done--thanks!
| @@ -0,0 +1 @@ | |||
| 17 | |||
There was a problem hiding this comment.
Seems unrelated to the main change
There was a problem hiding this comment.
This is jenv's config file; I added to align with the same in the parent pom.
Would you prefer the change in a different PR? Or added to gitignore?
Overview
This PR adds the ability to access a pull request that was merged into a PR/branch. Example:
masterbranch.masterand wants to be able to access detail for PR 123.Resolves #1.
Additional detail
This was implemented such that the new
mergedPullRequestglobal variable is available if the following is true:The newly-added
Detect Merged Pull Requesttrait is added to build's behaviors. This instructs the build to search for a potential merged pull request:The most recent update to the branch or pull request was due to an upstream pull request being merged.
Testing done
This was manually tested locally with a test repo that references the new features: https://github.com/l3ender/jenkins-pipeline-github-plugin-testing.
The local Jenkins builds were configured with the necessary trait to enable to new feature, both in branch-based and PR-based builds.
Submitter checklist