From 6ed192a8969f181eaf3314262f08ab5f1b8455ac Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 11 Dec 2025 20:08:02 +0100 Subject: [PATCH 1/3] Properly handle `ref_branch`, default to `main` --- github_activity/github_activity.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/github_activity/github_activity.py b/github_activity/github_activity.py index 650bc6e..f778d57 100644 --- a/github_activity/github_activity.py +++ b/github_activity/github_activity.py @@ -690,9 +690,11 @@ def filter_ignored(userlist): this_md = f"- {ititle} [#{irowdata['number']}]({irowdata['url']}) ({contributor_list})" items["md"].append(this_md) - # Get functional GitHub references: any git reference or master@{YY-mm-dd} + # Get functional GitHub references: any git reference or {branch}@{YY-mm-dd} + # Use the branch parameter if provided, otherwise default to "main" + ref_branch = branch or "main" if closed_prs.size > 0 and not data.since_is_git_ref: - since = f"master@{{{data.since_dt:%Y-%m-%d}}}" + since = f"{ref_branch}@{{{data.since_dt:%Y-%m-%d}}}" closest_date_start = closed_prs.loc[ abs( pd.to_datetime(closed_prs["closedAt"], utc=True) @@ -704,7 +706,7 @@ def filter_ignored(userlist): since_ref = since if closed_prs.size > 0 and not data.until_is_git_ref: - until = f"master@{{{data.until_dt:%Y-%m-%d}}}" + until = f"{ref_branch}@{{{data.until_dt:%Y-%m-%d}}}" closest_date_stop = closed_prs.loc[ abs( pd.to_datetime(closed_prs["closedAt"], utc=True) From 13863852c218d6dbe666c11c3a88a10abf660e33 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 11 Dec 2025 20:17:15 +0100 Subject: [PATCH 2/3] update tests --- tests/test_cli.py | 2 +- tests/test_cli/cli_def_branch.md | 2 +- tests/test_cli/cli_no_target.md | 2 +- tests/test_cli/cli_no_target_pyproject.md | 2 +- tests/test_cli/cli_w_parts.md | 2 +- tests/test_cli/cli_w_url.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index a1a7ef5..65c084b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -20,7 +20,7 @@ ), # CLI with default branch ( - "github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output} -b master", + "github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output} -b main", "cli_def_branch", ), # CLI with no target diff --git a/tests/test_cli/cli_def_branch.md b/tests/test_cli/cli_def_branch.md index 90c9660..d9244a8 100644 --- a/tests/test_cli/cli_def_branch.md +++ b/tests/test_cli/cli_def_branch.md @@ -1,4 +1,4 @@ -# master@{2021-01-01}...master@{2021-01-15} +# main@{2021-01-01}...main@{2021-01-15} ([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88)) diff --git a/tests/test_cli/cli_no_target.md b/tests/test_cli/cli_no_target.md index 90c9660..d9244a8 100644 --- a/tests/test_cli/cli_no_target.md +++ b/tests/test_cli/cli_no_target.md @@ -1,4 +1,4 @@ -# master@{2021-01-01}...master@{2021-01-15} +# main@{2021-01-01}...main@{2021-01-15} ([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88)) diff --git a/tests/test_cli/cli_no_target_pyproject.md b/tests/test_cli/cli_no_target_pyproject.md index 4496581..7f4c79c 100644 --- a/tests/test_cli/cli_no_target_pyproject.md +++ b/tests/test_cli/cli_no_target_pyproject.md @@ -1,4 +1,4 @@ -##### master@{2021-01-01}...master@{2021-01-15} +##### main@{2021-01-01}...main@{2021-01-15} ([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88)) diff --git a/tests/test_cli/cli_w_parts.md b/tests/test_cli/cli_w_parts.md index 90c9660..d9244a8 100644 --- a/tests/test_cli/cli_w_parts.md +++ b/tests/test_cli/cli_w_parts.md @@ -1,4 +1,4 @@ -# master@{2021-01-01}...master@{2021-01-15} +# main@{2021-01-01}...main@{2021-01-15} ([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88)) diff --git a/tests/test_cli/cli_w_url.md b/tests/test_cli/cli_w_url.md index 90c9660..d9244a8 100644 --- a/tests/test_cli/cli_w_url.md +++ b/tests/test_cli/cli_w_url.md @@ -1,4 +1,4 @@ -# master@{2021-01-01}...master@{2021-01-15} +# main@{2021-01-01}...main@{2021-01-15} ([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88)) From 9924b2181246170e01cc21c4919f099ed5492dcb Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Thu, 11 Dec 2025 20:22:32 +0100 Subject: [PATCH 3/3] fix --- tests/test_cli.py | 4 ++-- tests/test_cli/cli_def_branch.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 65c084b..4adf776 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -18,9 +18,9 @@ "github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output}", "cli_w_parts", ), - # CLI with default branch + # CLI with explicit branch filter (using master since that was likely the name in 2021) ( - "github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output} -b main", + "github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output} -b master", "cli_def_branch", ), # CLI with no target diff --git a/tests/test_cli/cli_def_branch.md b/tests/test_cli/cli_def_branch.md index d9244a8..90c9660 100644 --- a/tests/test_cli/cli_def_branch.md +++ b/tests/test_cli/cli_def_branch.md @@ -1,4 +1,4 @@ -# main@{2021-01-01}...main@{2021-01-15} +# master@{2021-01-01}...master@{2021-01-15} ([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88))