Skip to content

Conversation

@donbarbos
Copy link

@donbarbos donbarbos commented Nov 21, 2025

Inspired by #180

I used next script:
import os
import re

def add_pr_links_to_changelog(content: str) -> str:
    # See https://github.com/typeshed-internal/stub_uploader/blob/main/stub_uploader/update_changelog.py#L101
    return re.sub(r"\(#(\d+)\)", r"([#\1](https://github.com/python/typeshed/pull/\1))", content)


if __name__ == "__main__":
    directory_path = "./data/changelogs"
    for filename in os.listdir(directory_path):
        file_path = os.path.join(directory_path, filename)

        if filename.endswith(".md"):
            with open(file_path, "r", encoding="utf-8") as file:
                content = file.read()

            updated_content = add_pr_links_to_changelog(content)

            with open(file_path, "w", encoding="utf-8") as file:
                file.write(updated_content)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant