From 77eb8ccceecaf5efb650bd55ece18a5e3ad69aa7 Mon Sep 17 00:00:00 2001 From: Kevin Schoedel <67607049+kpschoedel@users.noreply.github.com> Date: Fri, 5 Nov 2021 14:02:57 -0400 Subject: [PATCH] Size reports: Fix stale-commit determination (#11483) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### Problem Some size reports are missing. The reason is that `gh_report.py` uses the commit ‘committer’ time to determine which commits are outdated, and a rebase sets that to the same value for all commits in a PR. #### Change overview Use the ‘author’ timestamp as a secondary sort key. #### Testing Manual run confirming sort order. --- scripts/tools/memory/gh_report.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index 38141a0ac5c69e..0669be621eef6e 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -491,9 +491,10 @@ def gh_send_change_report(db: SizeDatabase, df: pd.DataFrame) -> bool: # Check the most recent commit on the PR, so that we don't comment on # builds that are already outdated. commit = df.attrs['commit'] - commits = sorted(gh_get_commits_for_pr(db.gh, pr), - key=lambda c: c.commit.committer.date, - reverse=True) + commits = sorted( + gh_get_commits_for_pr(db.gh, pr), + key=lambda c: f'{c.commit.committer.date}{c.commit.author.date}', + reverse=True) if commits and commit != commits[0].sha: logging.info('SCS: PR #%s: not commenting for stale %s; newest is %s', pr, commit, commits[0].sha)