Skip to content

Compare submissions against their merge base - #973

Merged
ludeeus merged 1 commit into
mainfrom
frenck/bot-diff-against-merge-base
Oct 17, 2026
Merged

ludeeus merged 1 commit into
mainfrom
frenck/bot-diff-against-merge-base

Conversation

@frenck

@frenck frenck commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

getFileDiff() compared the category file of the pull request with master as it is when the bot runs, because getContent was called without a ref. hacs/default merges several submissions a day into the same file. When one of those lands between the submitter updating their branch and the bot handling the event, its entry shows up as a second change, and the pull request is converted to draft with "Your branch seems out of date". Updating the branch doesn't help, since it isn't behind. hacs/default#8710 got stuck on this repeatedly.

The file is now read at the merge base, which the compareCommitsWithBasehead call a few lines earlier already returns. That compares exactly what the pull request changes. The separate check for a branch that is behind stays as it is.

The pull_number argument is dropped, getContent doesn't take it.

Checked with tsc and prettier. The build reports the same 7 errors as main (in index.ts, tasks.ts and node:async_hooks), none in this file.

Fixes #974

The category file was compared with master at the time the bot runs. When
other pull requests were merged in the meantime, their entries showed up
as changes too, and an up to date branch was converted to draft.
Copilot AI balanced review requested due to automatic review settings October 17, 2026 06:57
@frenck frenck added the bug Something isn't working label Oct 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change fixes the unpinned baseline comparison without any identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes #974 by comparing submission contents against the pull request’s merge base, preventing unrelated merges from causing false draft conversions.

Changes:

  • Pins the baseline content request to the merge-base SHA.
  • Removes the unsupported pull_number argument from getContent.
  • Preserves the existing behind-branch check.
File Description
src/​plugins/​pull_request.opened.default.ts Passes the merge-base SHA into getFileDiff and uses it when fetching baseline content.

Review effort: Balanced

@ludeeus
ludeeus merged commit 86d94e4 into main Oct 17, 2026
5 checks passed
@ludeeus
ludeeus deleted the frenck/bot-diff-against-merge-base branch October 17, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False "branch seems out of date" draft conversion caused by comparing against live master instead of a pinned ref

3 participants