Skip to content

Commit

Permalink
Merge pull request #46 from jenkinsci/fix-latest-date
Browse files Browse the repository at this point in the history
Use correct "latest commit date" for GitHub PRs
  • Loading branch information
TobiX authored Oct 24, 2024
2 parents 9d01cee + e4110d3 commit 2ca09cc
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,18 @@ public boolean isExcluded(@NonNull SCMSourceRequest scmSourceRequest, @NonNull S
.findAny();
if (pull.isPresent()) {
PagedIterator<GHPullRequestCommitDetail> iterator =
pull.get().listCommits().withPageSize(1).iterator();
// Has at least one commit
if (iterator.hasNext()) {
long pullTS = iterator.next()
pull.get().listCommits().iterator();
long latestPullTS = 0;
while (iterator.hasNext()) {
long commitTS = iterator.next()
.getCommit()
.getAuthor()
.getCommitter()
.getDate()
.getTime();
return pullTS < super.getAcceptableDateTimeThreshold();
if (commitTS > latestPullTS) latestPullTS = commitTS;
}
// Did we see at least one commit?
if (latestPullTS > 0) return latestPullTS < super.getAcceptableDateTimeThreshold();
}
return false;
} else if (scmHead instanceof GitHubTagSCMHead) {
Expand Down

0 comments on commit 2ca09cc

Please sign in to comment.