mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
dev-cmd/contributions: Support date ranges in PR reviews query
- Now `brew contributions --from=2023-02-23 --to=2023-02-26` works to limit the results for reviews. I forgot this in the original implementation, again, ugh.
This commit is contained in:
parent
a13556a1a6
commit
a2d31faa72
@ -175,7 +175,7 @@ module Homebrew
|
|||||||
commits: GitHub.repo_commit_count_for_user(repo_full_name, person, args),
|
commits: GitHub.repo_commit_count_for_user(repo_full_name, person, args),
|
||||||
coauthorships: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", args),
|
coauthorships: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", args),
|
||||||
signoffs: git_log_trailers_cmd(T.must(repo_path), person, "Signed-off-by", args),
|
signoffs: git_log_trailers_cmd(T.must(repo_path), person, "Signed-off-by", args),
|
||||||
reviews: GitHub.count_issues("", is: "pr", repo: repo_full_name, reviewed_by: person),
|
reviews: GitHub.count_issues("", is: "pr", repo: repo_full_name, reviewed_by: person, args: args),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -173,11 +173,21 @@ module GitHub
|
|||||||
def search_query_string(*main_params, **qualifiers)
|
def search_query_string(*main_params, **qualifiers)
|
||||||
params = main_params
|
params = main_params
|
||||||
|
|
||||||
params += qualifiers.flat_map do |key, value|
|
if (args = qualifiers.fetch(:args, nil))
|
||||||
|
params << if args.from && args.to
|
||||||
|
"created:#{args.from}..#{args.to}"
|
||||||
|
elsif args.from
|
||||||
|
"created:>=#{args.from}"
|
||||||
|
elsif args.to
|
||||||
|
"created:<=#{args.to}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
params += qualifiers.except(:args).flat_map do |key, value|
|
||||||
Array(value).map { |v| "#{key.to_s.tr("_", "-")}:#{v}" }
|
Array(value).map { |v| "#{key.to_s.tr("_", "-")}:#{v}" }
|
||||||
end
|
end
|
||||||
|
|
||||||
"q=#{URI.encode_www_form_component(params.join(" "))}&per_page=100"
|
"q=#{URI.encode_www_form_component(params.compact.join(" "))}&per_page=100"
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_to(*subroutes)
|
def url_to(*subroutes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user