Tools: Update weekly report script to use Gitea Markdown syntax
Update for the changed way to host weekly reports, they should now live on projects.blender.org using Gitea Markdown syntax. See https://devtalk.blender.org/t/weekly-reports-2024-new-structure/32725.
This commit is contained in:
@@ -101,15 +101,15 @@ def report_personal_weekly_get(username, start, verbose=True):
|
||||
elif op_type == "commit_repo":
|
||||
if activity["ref_name"] == "refs/heads/main" and activity["content"]:
|
||||
content_json = json.loads(activity["content"])
|
||||
repo_name = activity["repo"]["name"]
|
||||
repo_fullname = activity["repo"]["full_name"]
|
||||
for commits in content_json["Commits"]:
|
||||
title = commits["Message"].split('\n', 1)[0]
|
||||
|
||||
# Substitute occurrences of "#\d+" with "{{Issue|\d+|repo}}"
|
||||
title = re.sub(r"#(\d+)", rf"{{{{Issue|\1|{repo_name}}}}}", title)
|
||||
# Substitute occurrences of "#\d+" with "repo#\d+"
|
||||
title = re.sub(r"#(\d+)", rf"{repo_fullname}#\1", title)
|
||||
|
||||
hash_value = commits["Sha1"][:10]
|
||||
commits_main.append(f"{title} ({{{{GitCommit|{hash_value}|{repo_name}}}}})")
|
||||
commits_main.append(f"{title} ({repo_fullname}@{hash_value})")
|
||||
|
||||
date_end = date_curr
|
||||
len_total = len(issues_closed) + len(issues_commented) + len(pulls_commented)
|
||||
@@ -175,7 +175,7 @@ def report_personal_weekly_get(username, start, verbose=True):
|
||||
|
||||
issues_involved = issues_closed | issues_commented | issues_created
|
||||
|
||||
print("\'\'\'Involved in %s reports:\'\'\' " % len(issues_involved))
|
||||
print("**Involved in %s reports:** " % len(issues_involved))
|
||||
print("* Confirmed: %s" % len(issues_confirmed))
|
||||
print("* Closed as Resolved: %s" % len(issues_fixed))
|
||||
print("* Closed as Archived: %s" % len(issues_archived))
|
||||
@@ -190,20 +190,20 @@ def report_personal_weekly_get(username, start, verbose=True):
|
||||
for pull in pulls:
|
||||
pull_data = gitea_json_issue_get_cached(pull)
|
||||
title = pull_data["title"]
|
||||
_, repo, _, number = pull.split('/')
|
||||
print(f"* {{{{PullRequest|{number}|{repo}}}}}: {title}")
|
||||
owner, repo, _, number = pull.split('/')
|
||||
print(f"* {owner}/{repo}!{number}: {title}")
|
||||
|
||||
print("'''Review: %s'''" % len(pulls_reviewed))
|
||||
print("**Review: %s**" % len(pulls_reviewed))
|
||||
print_pulls(pulls_reviewed)
|
||||
print()
|
||||
|
||||
# Print created diffs
|
||||
print("'''Created pulls: %s'''" % len(pulls_created))
|
||||
print("**Created pulls: %s**" % len(pulls_created))
|
||||
print_pulls(pulls_created)
|
||||
print()
|
||||
|
||||
# Print commits
|
||||
print("'''Commits:'''")
|
||||
print("**Commits:**")
|
||||
for commit in commits_main:
|
||||
print("*", commit)
|
||||
print()
|
||||
@@ -265,7 +265,7 @@ def main() -> None:
|
||||
start_date_str = start_date.strftime('%b %d')
|
||||
end_date_str = friday.strftime('%b %d')
|
||||
|
||||
print("== Week %d (%s - %s) ==\n\n" % (week, start_date_str, end_date_str))
|
||||
print("## Week %d (%s - %s)\n\n" % (week, start_date_str, end_date_str))
|
||||
report_personal_weekly_get(username, start_date, verbose=args.verbose)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user