ghprb icon indicating copy to clipboard operation
ghprb copied to clipboard

Generate the proper changelog/changeset for the PR.

Open gena01 opened this issue 10 years ago • 10 comments

I am seeing way too much noise in the changelog generated by ghprb if I am merging into different release branches and using the same Jenkins Job. Would be nice to be able to see the proper list of commits/changes.

Github API does provide for a way to fetch this: https://developer.github.com/v3/pulls/#list-commits-on-a-pull-request

A changeset can also be generated based on the merged hash with something like: git log pull_21^1..pull_21^2

gena01 avatar May 23 '14 17:05 gena01

Are you seeing this on the initial build? Or subsequent builds? Or both?

valdisrigdon avatar May 23 '14 17:05 valdisrigdon

Just tested this again with one of my PRs (PR has only 1 commit):

  • Initial build (jenkins build 55) shows "Changes" listing 174 Commits
  • Did "retest this please" (jenkins build 59) shows "Changes" listing 185 commits.

Jenkins ver. 1.563 ghprb 1.12

gena01 avatar May 23 '14 17:05 gena01

Which version of the plugin? There was a fix put in for this that should help get the right changeset.

valdisrigdon avatar May 23 '14 17:05 valdisrigdon

1.12 (latest stable)

gena01 avatar May 23 '14 18:05 gena01

Currently I am only 1 build behind on the actual Jenkins (1.563). Everything else is updated to the latest stable.

gena01 avatar May 23 '14 18:05 gena01

I think I'm seeing this same behavior. Far more commits than should be included are included in the reported information. I added the 'wipe out repository and force clone hoping it would improve things; it hasn't fixed the issue.

ncolton avatar Jun 06 '14 22:06 ncolton

I'm seeing this issue as well intermittently. I believe it has to do with how Jenkins calculates the change set difference between a build and its previous build (https://github.com/jenkinsci/git-plugin/blob/ac8f3549d7141ae310138fb73f35d7e6b5e58f82/src/main/java/hudson/plugins/git/GitSCM.java#L971-L1012)

Looks like they calculate the difference in commits contained within the build, so if a PR is rebased, then a bunch of commits that are from the "trunk" and were not in the previous built get included.

IMO, the plugin should override this behavior and simply set the changeset to be the commits that the Github API reports are in the PR.

johnrengelman avatar Sep 04 '14 14:09 johnrengelman

+1 we're being hit by this as well. Would be cool if this could be made to work reliably..

vorburger avatar Sep 10 '14 15:09 vorburger

The plugin already uses Github API to pull a list of commits here: https://github.com/jenkinsci/ghprb-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java#L220

Why not pull that list into a changelog?

gena01 avatar Sep 10 '14 16:09 gena01

might be relevant to this issue: https://stackoverflow.com/questions/16306012/github-pull-request-showing-commits-that-are-already-in-target-branch

michellejohnstone avatar Jul 20 '20 22:07 michellejohnstone