mirror of
https://github.com/Homebrew/brew.git
synced 2026-10-28 09:34:42 +08:00
Merge pull request #24260 from Homebrew/approved_review_end_date
Exclude end date from approved-review searches
This commit is contained in:
2 files changed
+13
-9
No files matched your search
@@ -467,12 +467,15 @@ module Homebrew
|
||||
|
||||
review_users = github_users.filter_map { |user, github_user| [user, github_user] if github_user }
|
||||
review_users.reject! { |user, _| lead_activity_met?(results.fetch(user)) } if skip_reviews_if_lead_met
|
||||
approved_to = Date.iso8601(to).prev_day.iso8601
|
||||
review_users.each_with_index do |(user, github_user), index|
|
||||
if progress
|
||||
$stderr.puts "Querying approved-review search for #{user} (#{index + 1}/#{review_users.length})..."
|
||||
end
|
||||
approved_reviews = cached_github_request(Array, "approved", organisation, github_user, from, to, to:) do
|
||||
GitHub.search_approved_pull_requests_in_user_or_organisation(organisation, github_user, from:, to:)
|
||||
approved_reviews = cached_github_request(Array, "approved", organisation, github_user, from, approved_to,
|
||||
to:) do
|
||||
GitHub.search_approved_pull_requests_in_user_or_organisation(organisation, github_user,
|
||||
from:, to: approved_to)
|
||||
end
|
||||
capped_reviews = approved_reviews.length >= MAX_PR_SEARCH
|
||||
results.fetch(user).fetch(repositories.fetch(0))[:approved_pr_review_hit_cap] = 1 if capped_reviews
|
||||
@@ -496,9 +499,10 @@ module Homebrew
|
||||
qualifying_total >= MAINTAINER_ACTIVITY_THRESHOLD
|
||||
|
||||
$stderr.puts "Querying approved-review search for #{user} in #{repository}..." if progress
|
||||
repository_reviews = cached_github_request(Array, "approved", repository, github_user, from, to, to:) do
|
||||
repository_reviews = cached_github_request(Array, "approved", repository, github_user,
|
||||
from, approved_to, to:) do
|
||||
GitHub.search_issues("", is: "pr", review: "approved", repo: repository, reviewed_by: github_user,
|
||||
from:, to:)
|
||||
from:, to: approved_to)
|
||||
end
|
||||
repository_counts[:approved_pr_review] = repository_reviews.length
|
||||
end
|
||||
|
||||
@@ -630,7 +630,7 @@ RSpec.describe Homebrew::DevCmd::Contributions do
|
||||
.with("", is: "merged", user: "Homebrew", author: "alice", merged: "2026-01-01..2026-01-31")
|
||||
.and_return([{ "number" => 123, "repository_url" => "#{GitHub::API_URL}/repos/#{repository}" }])
|
||||
expect(GitHub).to receive(:search_approved_pull_requests_in_user_or_organisation)
|
||||
.with("Homebrew", "alice", from: "2026-01-01", to: "2026-02-01")
|
||||
.with("Homebrew", "alice", from: "2026-01-01", to: "2026-01-31")
|
||||
.and_return([])
|
||||
|
||||
results = command.scan_contributions(
|
||||
@@ -944,13 +944,13 @@ RSpec.describe Homebrew::DevCmd::Contributions do
|
||||
.with("", is: "merged", user: "Homebrew", author: "alice", merged: "2025-12-01..2026-02-28")
|
||||
.and_return([])
|
||||
allow(GitHub).to receive(:search_approved_pull_requests_in_user_or_organisation)
|
||||
.with("Homebrew", "alice", from: "2025-12-01", to: "2026-03-01")
|
||||
.with("Homebrew", "alice", from: "2025-12-01", to: "2026-02-28")
|
||||
.and_return(Array.new(100) do
|
||||
{ "repository_url" => "#{GitHub::API_URL}/repos/Homebrew/homebrew-cask" }
|
||||
end)
|
||||
expect(GitHub).to receive(:search_issues)
|
||||
.with("", is: "pr", review: "approved", repo: "Homebrew/brew", reviewed_by: "alice",
|
||||
from: "2025-12-01", to: "2026-03-01")
|
||||
from: "2025-12-01", to: "2026-02-28")
|
||||
.and_return(Array.new(25) { {} })
|
||||
|
||||
results = command.scan_contributions(
|
||||
@@ -969,7 +969,7 @@ RSpec.describe Homebrew::DevCmd::Contributions do
|
||||
end).to eq("Homebrew/brew" => 25, "Homebrew/homebrew-core" => 0, "Homebrew/homebrew-cask" => 100)
|
||||
end
|
||||
|
||||
it "uses the existing approved review search" do
|
||||
it "excludes the end date from approved review searches" do
|
||||
command = described_class.new(["--maintainer-report-csv=2026-1"])
|
||||
repositories = Homebrew::DevCmd::Contributions::PRIMARY_REPOS.to_h do |repository|
|
||||
[repository, [Pathname("/#{repository}"), "origin/HEAD"]]
|
||||
@@ -985,7 +985,7 @@ RSpec.describe Homebrew::DevCmd::Contributions do
|
||||
.with("", is: "merged", user: "Homebrew", author: "alice", merged: "2025-12-01..2026-02-28")
|
||||
.and_return([])
|
||||
allow(GitHub).to receive(:search_approved_pull_requests_in_user_or_organisation)
|
||||
.with("Homebrew", "alice", from: "2025-12-01", to: "2026-03-01")
|
||||
.with("Homebrew", "alice", from: "2025-12-01", to: "2026-02-28")
|
||||
.and_return([
|
||||
{ "repository_url" => "#{GitHub::API_URL}/repos/Homebrew/brew" },
|
||||
{ "repository_url" => "#{GitHub::API_URL}/repos/Homebrew/homebrew-core" },
|
||||
|
||||
Reference in new issue
Block a user