Skip to content

fix: use event.before SHA for synchronize diff#205

Open
Br1an67 wants to merge 1 commit intoanc95:mainfrom
Br1an67:fix/issue-202-synchronize-before
Open

fix: use event.before SHA for synchronize diff#205
Br1an67 wants to merge 1 commit intoanc95:mainfrom
Br1an67:fix/issue-202-synchronize-before

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 1, 2026

What

Use context.payload.before (the HEAD SHA before the synchronize push) as the fallback comparison base instead of comparing the last two commits in the PR.

Closes #202

Why

On synchronize events, a push can contain multiple commits. The previous fallback only compared the last two commits (commits[n-2]..commits[n-1]), missing intermediate changes. event.before accurately represents the PR HEAD before the push, so before..head captures all new changes.

How

  • Primary strategy (unchanged): compare from the last bot review commit to the current HEAD
  • Fallback (fixed): use context.payload.before instead of commits[commits.length - 2].sha
  • Same fallback used in the catch block for robustness

Testing

  • TypeScript compilation passes (only pre-existing .cjs errors)
  • Minimal change: 1 file, ~10 lines changed

…mmits

On synchronize events, the previous fallback only compared the last two
commits in the PR. This misses changes when multiple commits are pushed
at once. Now uses context.payload.before (the HEAD SHA before the push)
to correctly capture all new changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Commits on synchronize event

1 participant