We already resolve the GitHub user to the Mattermost user when generating the template and posting to Mattermost -- e.g. @saturninoabril becomes @saturnino.abril, given our knowledge of the linking in the GitHub plugin:

but let's also consider doing this in the body of notifications as well, so that @asaadmahmood, @marianunez and @lieut-data become @asaad.mahmood, @maria.nunez and @jesse.hallam respectively:

Of course, if no known Mattermost user has that GitHub username, we can leave the GitHub user intact.
The Jira plugin does it already, see https://github.com/mattermost/mattermost-plugin-jira/blob/ec8f206261f3b96045f58378b70469333538aac7/server/webhook.go#L145
I would like to work on this one.
I am planning to solve this as follows:
funcMap in template.go that receives a string and returns that same string with all the GitHub usernames resolved to their assigned Mattermost usernames, if any. If no Mattermost username is found, the GitHub username will remain unchanged. This function will be really similar to the one @levb pointed to, replaceJiraAccountIds.template_test.go so we can make sure it resolves all mapped GitHub usernames..GetBody function, piping that body into the new registered function. The templates to modify are:newPRnewIssueissueCommentpullRequestReviewEventnewReviewCommentcommentMentionNotificationcommentAuthorPullRequestNotificationpullRequestReviewNotificationtemplate_test.go so that we test the changes in the body both when there is a gitHubToUsernameMappingCallback registered and when there is not.Some notes:
@wrong--username).ii and iii but not i. In the rare case that we would match a string with more than 39 characters, we would not have any mapping to a Mattermost user, so the string will remain unchanged.[email protected]), an underscore (_) or a backtick (`).[^_\x60[:alnum:]]@[[:alnum:]](-?[[:alnum:]]+)*, where \x60 is the backtick character.I have already started working on this, but please tell me if you would like me to implement something in a different way.
Thanks again, @agarciamontoro!