Escape GitHub @mentions in template update PR bodies#491
Draft
Escape GitHub @mentions in template update PR bodies#491
Conversation
…tions Agent-Logs-Url: https://github.com/scverse/cookiecutter-scverse/sessions/e4339c85-f7eb-448e-a159-c267faf3583c Co-authored-by: grst <7051479+grst@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Automate escaping GitHub usernames in release messages
Escape GitHub @mentions in template update PR bodies
Mar 30, 2026
Member
There was a problem hiding this comment.
it’s probably fine, but if we wanted this to be robust, we’d need to
- parse markdown
- find the spans containing usernames
- if we parsed it as GFM with the username extension – just use that
- if we parsed as regular markdown – find the
@…pattern in regular text parts (but not code parts or so)
- replace (I guess just reversing the list of replacements before performing them would be fine)
Collaborator
|
I like the suggestion. Is there any library for GFM parsing that you would recommend? |
Member
|
Hm, the established ones don’t have a real AST with source locations, but this one looks good: https://lbliii.github.io/patitas/ |
Collaborator
|
are you sure this supports parsing usernames? I couldn't find anything related to that in the docs... |
|
A PR has been generated to the instance repo: scverse/cookiecutter-scverse-instance#269 You can check out the PR to preview your changes in an instance of the cookiecutter template. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release notes included in cruft update PRs contain raw
@usernamementions, causing all contributors to be subscribed to 150+ PRs on every release._escape_github_mentions()to wrap@username→`@username`using regex with negative lookbehind to skip already-escaped mentions and email addressesTemplateUpdatePR.bodyafter template formatting