Skip to content

Commit 34873ef

Browse files
feat: update team configuration and enhance PR fetching functionality
This commit introduces several updates and enhancements: - Added new team members to the `teams.cfg` file for improved team mapping. - Updated the PR fetching functions in `batch.py` and `github.py` to focus on merged PRs, enhancing clarity in reporting. - Introduced a new parameter `merged_only` in the `search_closed_prs` function to allow filtering for merged PRs only. - Added new scripts for fetching PRs from June–July and August–September 2025, including complexity labeling. These changes improve the accuracy of team contributions and streamline the process of analyzing merged PRs.
1 parent ac4cbf9 commit 34873ef

6 files changed

Lines changed: 53 additions & 5 deletions

File tree

cli/batch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def generate_pr_list_from_date_range(
135135

136136
# Fetch from GitHub
137137
typer.echo(
138-
f"Fetching closed PRs for org '{org}' from {effective_since.date()} to {until.date()}...",
138+
f"Fetching merged PRs for org '{org}' from {effective_since.date()} to {until.date()}...",
139139
err=True,
140140
)
141141
cache_file_handle = None
@@ -331,7 +331,7 @@ def generate_pr_list_from_repos_file(
331331

332332
repos = load_repos_from_file(repos_file)
333333
typer.echo(
334-
f"Fetching closed PRs for {len(repos)} repo(s) from {effective_since.date()} to {until.date()}...",
334+
f"Fetching merged PRs for {len(repos)} repo(s) from {effective_since.date()} to {until.date()}...",
335335
err=True,
336336
)
337337

@@ -367,7 +367,7 @@ def progress_msg(msg: str) -> None:
367367
on_pr_found=write_pr_to_cache if cache_file else None,
368368
progress_callback=progress_msg,
369369
client=client,
370-
merged_only=False,
370+
merged_only=True,
371371
)
372372
typer.echo(f"Found {len(urls)} PRs", err=True)
373373
return urls

cli/github.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,7 @@ def search_closed_prs(
13801380
max_retries: int = 5,
13811381
progress_callback: Optional[Callable[[str], None]] = None,
13821382
client: Optional[httpx.Client] = None,
1383+
merged_only: bool = True,
13831384
) -> List[str]:
13841385
"""
13851386
Search for closed PRs in an organization within a date range.
@@ -1398,6 +1399,7 @@ def search_closed_prs(
13981399
max_retries: Maximum number of retries for rate limit errors
13991400
progress_callback: Optional callback for progress messages (e.g., rate limit warnings)
14001401
client: Optional httpx.Client to reuse connections
1402+
merged_only: If True, search for merged PRs only (default: True)
14011403
14021404
Returns:
14031405
List of PR URLs (e.g., ["https://github.com/org/repo/pull/123", ...])
@@ -1412,7 +1414,10 @@ def search_closed_prs(
14121414

14131415
since_str = since.strftime("%Y-%m-%d")
14141416
until_str = until.strftime("%Y-%m-%d")
1415-
query = f"org:{org} is:pr is:closed closed:{since_str}..{until_str}"
1417+
if merged_only:
1418+
query = f"org:{org} is:pr is:merged merged:{since_str}..{until_str}"
1419+
else:
1420+
query = f"org:{org} is:pr is:closed closed:{since_str}..{until_str}"
14161421

14171422
should_close_client = client is None
14181423
if client is None:

scripts/fetch-aug-sep-2025.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# Fetch August–September 2025 PRs, add complexity labels if not present.
3+
# Run this after June–July 2025 fetch completes.
4+
# Results are saved to complexity-report.csv in the project root.
5+
6+
cd "$(dirname "$0")/.."
7+
OUTPUT_CSV="$(pwd)/complexity-report.csv"
8+
9+
complexity-cli batch-analyze \
10+
--all-repos \
11+
--since 2025-08-01 \
12+
--until 2025-09-30 \
13+
-o "$OUTPUT_CSV" \
14+
--overwrite \
15+
--label \
16+
--provider anthropic \
17+
--cache cache/aug-sep-2025-prs.txt
18+
19+
echo "Results saved to: $OUTPUT_CSV"

scripts/fetch-june-july-2025.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
# Fetch June–July 2025 PRs, add complexity labels if not present.
3+
# Results are saved to complexity-report.csv in the project root.
4+
5+
cd "$(dirname "$0")/.."
6+
OUTPUT_CSV="$(pwd)/complexity-report.csv"
7+
8+
complexity-cli batch-analyze \
9+
--all-repos \
10+
--since 2025-06-01 \
11+
--until 2025-07-31 \
12+
-o "$OUTPUT_CSV" \
13+
--overwrite \
14+
--label \
15+
--provider anthropic \
16+
--cache cache/june-july-2025-prs.txt
17+
18+
echo "Results saved to: $OUTPUT_CSV"

teams.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ yairabramovitch
1212
RonKlar90
1313
OmerMordechai1
1414
Lizkhrapov
15+
Amichai-B
1516
[CDC]
1617
aaronabv
1718
sigalikanevsky
19+
eitamring
20+
Omri-Groen
21+
shristiguptaa
1822
[Ninja]
1923
pocha-vijaymohanreddy
2024
mayanks-Boomi
2125
vs1328
2226
[Devops]
2327
alonalmog82
28+
EdenReuveniRivery
2429

tests/test_batch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def test_generate_pr_list_from_repos_file(mock_search, tmp_path):
102102
mock_search.assert_called_once()
103103
call_kwargs = mock_search.call_args.kwargs
104104
assert call_kwargs["repos"] == ["owner/repo-a", "owner/repo-b"]
105+
assert call_kwargs["merged_only"] is True
105106

106107

107108
@patch("cli.batch.search_closed_prs")
@@ -133,7 +134,7 @@ def test_generate_pr_list_from_github(mock_search, tmp_path):
133134
]
134135

135136
def mock_search_with_callback(
136-
org, since, until, token, sleep_s, on_pr_found, progress_callback, client
137+
org, since, until, token, sleep_s, on_pr_found, progress_callback, client, **kwargs
137138
):
138139
"""Mock that calls the on_pr_found callback for each URL."""
139140
for url in pr_urls:

0 commit comments

Comments
 (0)