Skip to content

Fix patch coverage diff base for branches behind main - #10007

Merged
glen-84 merged 2 commits into
mainfrom
gai/patch-coverage-diff-base
Jun 29, 2026
Merged

glen-84 merged 2 commits into
mainfrom
gai/patch-coverage-diff-base

Conversation

@glen-84

@glen-84 glen-84 commented Jun 29, 2026

Copy link
Copy Markdown
Member

Summary

  • The patch-coverage job computed changed lines as git diff <pull_request.base.sha>...HEAD. That base SHA is captured when the webhook fires and goes stale once main advances, so for a PR that's behind main the diff swept in every commit merged to main in between, massively inflating the reported file list.
  • It now diffs the merge commit's own parents (HEAD^1...HEAD^2), which yields the PR's true changes against the real fork point and matches GitHub's "Files changed" regardless of main drift.

Test plan

  • On a real PR that was behind main, the old base produced 202 changed .cs files; HEAD^1...HEAD^2 produces 13, matching GitHub's Files-changed count.

Copilot AI review requested due to automatic review settings June 29, 2026 18:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the patch-coverage workflow to compute diffs based on the PR merge commit’s parents, ensuring the reported changed lines/files match GitHub’s “Files changed” even when the PR branch is behind main.

Changes:

  • Switch patch-coverage diff base from ${{ github.event.pull_request.base.sha }}...HEAD to HEAD^1...HEAD^2.
  • Add inline workflow comments describing why the merge-parents diff is used.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Outdated
@glen-84
glen-84 merged commit 692016b into main Jun 29, 2026
147 checks passed
@glen-84
glen-84 deleted the gai/patch-coverage-diff-base branch June 29, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants