MCPcopy
hub / github.com/ActivityWatch/activitywatch / build

Function build

scripts/build_changelog.py:353–441  ·  view source on GitHub ↗
(
    org: str,
    repo: str,
    project_name: str,
    commit_range: Tuple[str, str],
    output_path: str,
    repo_order: List[str],
    filter_types: Optional[List[str]] = None,
    add_version_header: bool = False,
)

Source from the content-addressed store, hash-verified

351
352
353def build(
354 org: str,
355 repo: str,
356 project_name: str,
357 commit_range: Tuple[str, str],
358 output_path: str,
359 repo_order: List[str],
360 filter_types: Optional[List[str]] = None,
361 add_version_header: bool = False,
362):
363 # provides a commit summary for the repo and subrepos, recursively looking up subrepos
364 # NOTE: this must be done *before* `get_all_contributors` is called,
365 # as the latter relies on summary_repo looking up all users and storing in a global.
366 if not filter_types:
367 filter_types = ["build", "ci", "tests", "test"]
368
369 logger.info("Generating commit summary")
370 since, tag = commit_range
371 output_changelog = summary_repo(
372 org,
373 repo,
374 ".",
375 commit_range=commit_range,
376 filter_types=filter_types,
377 repo_order=repo_order,
378 )
379
380 output_changelog = f"""
381# Changelog
382
383Changes since {since}:
384
385{output_changelog}
386 """.strip()
387
388 # Would ideally sort by number of commits or something, but that's tricky
389 usernames = sorted(get_all_contributors(), key=str.casefold)
390 usernames = [u for u in usernames if not u.endswith("[bot]")]
391 twitter_handles = get_twitter_of_ghusers(usernames)
392 print(
393 "Twitter handles: "
394 + ", ".join("@" + handle for handle in twitter_handles.values() if handle),
395 )
396
397 output_contributors = f"""# Contributors
398
399Thanks to everyone who contributed to this release:
400
401{', '.join(('@' + username for username in usernames))}"""
402
403 # Header starts here
404 logger.info("Building final output")
405 output = f"These are the release notes for {project_name} version {tag}.".strip()
406 output += "\n\n"
407
408 # hardcoded for now
409 if repo == "activitywatch":
410 output += "**New to ActivityWatch?** Check out the [website](https://activitywatch.net) and the [README](https://github.com/ActivityWatch/activitywatch/blob/master/README.md)."

Callers 1

mainFunction · 0.85

Calls 3

summary_repoFunction · 0.85
get_all_contributorsFunction · 0.85
get_twitter_of_ghusersFunction · 0.85

Tested by

no test coverage detected