Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix changelog linkification script #411

Open
Kamforka opened this issue Mar 5, 2025 · 0 comments
Open

Fix changelog linkification script #411

Kamforka opened this issue Mar 5, 2025 · 0 comments
Assignees
Milestone

Comments

@Kamforka
Copy link
Collaborator

Kamforka commented Mar 5, 2025

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
@Kamforka Kamforka added this to the 2.0.0b10 milestone Mar 5, 2025
@Kamforka Kamforka self-assigned this Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant