getIssue() from GHPullRequest object
Could such method be added into PR object? Issue and PR content differs and it very inconvenient to do a call through parent like pr.getRepository().getIssue(pr.getNumber())
GHPullRequest extends from GHIssue, so the design here is to call GHPullRequest.fetchIssue() at the right point to ensure methods defined on GHIssue return correct info when used on GHPullRequest instance, such as getLabels() do.
For what methods are you seeing differing return values?
@kohsuke assumption that Issue and PR has the same data is wrong. They track different instances of data. Example is date time of changes: https://github.com/KostyaSha/github-pullrequest-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github/pullrequest/GitHubPRTrigger.java#L370-L371
And https://github.com/kohsuke/github-api/blob/master/src/main/java/org/kohsuke/github/GHPullRequest.java#L111 is Deprecated
More details about updated_at. If you change label or comment -> it issue change. If you change commits -> PR change. It looks like in GH internal structure it two different objects (and PR is not extended Issue). I'm afraid problems using api library if GH adds more fields, so i prefer using right objects for getting data. And getting Issue from PR seems logical, because it one-direction logical link.
, so the design here is to call GHPullRequest.fetchIssue() at the right point
Also this method is private, having fetchissue and populate methods public should help with getting almost atomic state of remote PR+issue.
It would be nice if there was an easier way to get a PR from an issue too.