Exemplo n.º 1
0
def get_release_notes(ctx: TagContext) -> None:
    click.secho("> Grabbing the release notes.", fg="cyan")
    changelog_file = "CHANGELOG.md"
    for name in RUBY_MONO_REPOS:
        if name in ctx.upstream_repo:
            changelog_file = f"{ctx.package_name}/CHANGELOG.md"
    changelog = ctx.github.get_contents(
        ctx.upstream_repo,
        changelog_file,
        ref=ctx.release_pr["merge_commit_sha"]).decode("utf-8")

    match = re.search(
        rf"^### {ctx.release_version} \/ \d\d\d\d-\d\d-\d\d\n(?P<notes>.+?)(\n###\s|\Z)",
        changelog,
        re.DOTALL | re.MULTILINE,
    )
    v13_match = re.search(
        rf"^### {ctx.release_version} \(\d\d\d\d-\d\d-\d\d\)\n(?P<notes>.+?)(\n###\s|\Z)",
        changelog,
        re.DOTALL | re.MULTILINE,
    )
    if match is not None:
        ctx.release_notes = match.group("notes").strip()
    elif v13_match is not None:
        ctx.release_notes = v13_match.group("notes").strip()
    else:
        ctx.release_notes = ""

    click.secho(f"Here's the release notes:\n\n{ctx.release_notes}\n")
Exemplo n.º 2
0
def _get_latest_release_notes(ctx: TagContext, changelog: str):
    match = re.search(
        rf"## v?\[?{ctx.release_version}[^\n]*\n(?P<notes>.+?)(\n##\s|\n### \[?[0-9]+\.|\Z)",
        changelog,
        re.DOTALL | re.MULTILINE,
    )
    if match is not None:
        ctx.release_notes = match.group("notes").strip()
    else:
        ctx.release_notes = ""
Exemplo n.º 3
0
def _get_latest_release_notes(ctx: TagContext, changelog: str):
    # the 'v' prefix is not used in the conventional-changelog templates
    # used in automated CHANGELOG generation:
    version = re.sub(r"^v", "", ctx.release_version)
    match = re.search(
        rf"## v?\[?{version}[^\n]*\n(?P<notes>.+?)(\n##\s|\n### \[?[0-9]+\.|\Z)",
        changelog,
        re.DOTALL | re.MULTILINE,
    )
    if match is not None:
        ctx.release_notes = match.group("notes").strip()
    else:
        ctx.release_notes = ""
Exemplo n.º 4
0
def get_release_notes(ctx: TagContext) -> None:
    click.secho("> Grabbing the release notes.", fg="cyan")

    match = re.search(
        r"This pull request was generated using releasetool\.\s+(.*)",
        ctx.release_pr["body"],
        re.DOTALL | re.MULTILINE,
    )
    if match is not None:
        ctx.release_notes = match.group(1).strip()
    else:
        ctx.release_notes = ""

    click.secho(f"Release notes:\n{ctx.release_notes}")
Exemplo n.º 5
0
def get_release_notes(ctx: TagContext) -> None:
    click.secho("> Grabbing the release notes.")
    changelog = ctx.github.get_contents(
        ctx.upstream_repo, f"CHANGELOG.md", ref=ctx.release_pr["merge_commit_sha"]
    ).decode("utf-8")

    match = re.search(
        rf"## {ctx.release_version}\n(?P<notes>.+?)(\n##\s|\Z)",
        changelog,
        re.DOTALL | re.MULTILINE,
    )
    if match is not None:
        ctx.release_notes = match.group("notes").strip()
    else:
        ctx.release_notes = ""
Exemplo n.º 6
0
def get_release_notes(ctx: TagContext) -> None:
    click.secho("> Grabbing the release notes.")
    if "google-cloud-python" in ctx.upstream_repo:
        changelog_path = f"{ctx.package_name}/CHANGELOG.md"
    else:
        changelog_path = "CHANGELOG.md"
    changelog = ctx.github.get_contents(
        ctx.upstream_repo,
        changelog_path,
        ref=ctx.release_pr["merge_commit_sha"]).decode("utf-8")

    match = re.search(
        r"#{2,3}[\s\W]+?" + ctx.release_version +
        r"*?\n(?P<notes>.+?)(\Z|\n#{2,3}\W*?\d)",
        changelog,
        re.DOTALL | re.MULTILINE,
    )
    if match is not None:
        ctx.release_notes = match.group("notes").strip()
    else:
        ctx.release_notes = ""
Exemplo n.º 7
0
def get_release_notes(ctx: TagContext) -> None:
    click.secho("> Grabbing the release notes.", fg="cyan")
    if ("google-cloud-ruby" in ctx.upstream_repo
            or "google-api-ruby-client" in ctx.upstream_repo):
        changelog_file = f"{ctx.package_name}/CHANGELOG.md"
    else:
        changelog_file = "CHANGELOG.md"
    changelog = ctx.github.get_contents(
        ctx.upstream_repo,
        changelog_file,
        ref=ctx.release_pr["merge_commit_sha"]).decode("utf-8")

    match = re.search(
        rf"^### {ctx.release_version} \/ \d\d\d\d-\d\d-\d\d\n(?P<notes>.+?)(\n###\s|\Z)",
        changelog,
        re.DOTALL | re.MULTILINE,
    )
    if match is not None:
        ctx.release_notes = match.group("notes").strip()
    else:
        ctx.release_notes = ""

    click.secho(f"Here's the release notes:\n\n{ctx.release_notes}\n")
Exemplo n.º 8
0
def get_release_notes(ctx: TagContext) -> None:
    click.secho("> Grabbing the release notes.", fg="cyan")
    ctx.release_notes = _parse_release_notes(ctx.release_pr["body"])
    click.secho(f"Release notes:\n{ctx.release_notes}")