def build_news(ctx, draft=False, yes=False):
    """ Build towncrier newsfragments.
    """

    report.info(ctx, "docs.build-news", "building changelog from news fragments")
    build_command = f"towncrier --version {ctx.metadata['version']}"
    if draft:
        report.warn(
            ctx,
            "docs.build-news",
            "building changelog as draft (results are written to stdout)",
        )
        build_command += " --draft"
    elif yes:
        report.warn(
            ctx, "docs.build-news", "removing news files without user confirmation (-y)"
        )
        build_command += " --yes"
    ctx.run(build_command, hide=None)
Build towncrier newsfragments.