Skip to content

Fix changelog linkification script #411

@Kamforka

Description

@Kamforka

The issue reference linkification logic of the scripts/linkify_release_notes.py is wrongly implemented.

It can be fixed with the below snippet:

def replace_issue_reference(match: re.Match) -> str:
    issue_number = match.groups()[0]
    issue_link = (
        f" [#{issue_number}]"
        f"(https://github.com/TheHive-Project/TheHive4py/issues/{issue_number})"
    )
    print(f"Replace `{match.group()}` by `{issue_link}`")
    return issue_link


def linkify_issue_references(release_notes: str) -> str:
    issue_ref_pattern = r" #(\d+)"
    linkified_release_notes = re.sub(
        pattern=issue_ref_pattern,
        repl=replace_issue_reference,
        string=release_notes,
    )
    return linkified_release_notes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions