Skip to content

Count squash-merge commits into the contributions count - #23221

Merged
MikeMcQuaid merged 8 commits into
mainfrom
contributions-merge-count
Jul 21, 2026
Merged

Count squash-merge commits into the contributions count#23221
MikeMcQuaid merged 8 commits into
mainfrom
contributions-merge-count

Conversation

@Moisan

@Moisan Moisan commented Jul 20, 2026

Copy link
Copy Markdown
Member

  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • AI was used to generate or assist with generating this PR.

I used codex 5.6 to generate most of the change. I reviewed the code, ran the tests and checked the command output manually for my username.


The contribution command was ignoring squash-merged PRs and normal merge commits whose head branch is under Homebrew/... rather than a contributor’s fork. (for example Homebrew/homebrew-core#286711 )

A quick check I used: brew contributions --user=moisan --from=2025-12-01 --to=2026-03-01. It was showing no authored PRs previously and 37 with this change.

Copilot AI review requested due to automatic review settings July 20, 2026 15:42

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

This PR updates brew contributions to include squash-merged (and other non-merge-commit) PRs in contribution counts by supplementing local Git history parsing with a GitHub “merged PRs authored” search.

Changes:

  • Always queries GitHub for authored merged PRs in the date range and uses the result to top up per-repository merged_pr_author/merged_pr counts beyond what can be derived from merge commits alone.
  • Adds a spec that verifies squash-merged PRs are counted even when a repository has local Git history.
  • Updates existing specs to account for the new GitHub merged-PR search.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Library/Homebrew/dev-cmd/contributions.rb Adds GitHub merged-PR search and “top-up” logic to count squash-merged PRs alongside Git-derived counts.
Library/Homebrew/test/dev-cmd/contributions_spec.rb Adds/adjusts specs to validate squash-merge counting and the new GitHub search behavior.

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

Comment thread Library/Homebrew/dev-cmd/contributions.rb

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! A few comments.

Comment thread Library/Homebrew/dev-cmd/contributions.rb Outdated
Comment thread Library/Homebrew/dev-cmd/contributions.rb Outdated
Comment thread Library/Homebrew/test/dev-cmd/contributions_spec.rb
Comment thread Library/Homebrew/dev-cmd/contributions.rb

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread Library/Homebrew/dev-cmd/contributions.rb Outdated

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread Library/Homebrew/dev-cmd/contributions.rb Outdated
Moisan and others added 2 commits July 20, 2026 18:06
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread Library/Homebrew/dev-cmd/contributions.rb
Comment thread Library/Homebrew/dev-cmd/contributions.rb

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good now, thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 0ae4235 Jul 21, 2026
42 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the contributions-merge-count branch July 21, 2026 17:22
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.

3 participants