Fix: Weekly report error when a user has a commit to a parent repo

With the recent Gitea update, parent repos (E.g. `blender/blender`) do
not have "parents" listed in the information gathered by API anymore.

This has lead to the weekly report script encountering errors if the
user has committed directly to a parent repo. This commit fixes that.

Pull Request: https://projects.blender.org/blender/blender/pulls/142701
This commit is contained in:
Alaska
2025-07-24 21:59:09 +02:00
committed by Sean Kim
parent ab09dec8fb
commit 121e9464f5

View File

@@ -241,11 +241,7 @@ def report_personal_weekly_get(
# PRs related to a single repository together, regardless of who happens to own them.
#
# So the following adds branches and PRs to a "target" repository, not the owning one.
target_repo_json = repo["parent"]
# There's no parent repo if the branch is on the same repo. Treat the repo itself as target.
if not target_repo_json and branch_name != repo["default_branch"]:
target_repo_json = repo
target_repo_json = repo.get("parent", repo)
target_repo_fullname = target_repo_json["full_name"] if target_repo_json else repo_fullname
# Substitute occurrences of "#\d+" with "repo#\d+"