mergeability / mergeable

🤖 All the missing GitHub automation 🙂 🙌
https://mergeable.us
GNU Affero General Public License v3.0
679 stars 120 forks source link

fix: search and replace of special annotations #735

Closed mesaugat closed 6 months ago

mesaugat commented 6 months ago

Current Problem

There isn't a way to tag authors as the annotation @@author is replaced by author.

expect(searchAndReplaceSpecialAnnotations('this is @@author', payload)).toBe('this is @creator')

    Expected: "this is @creator"
    Received: "this is  creator"
expect(searchAndReplaceSpecialAnnotations('this is something@author', payload)).toBe('this is somethingcreator')

    Expected: "this is somethingcreator"
    Received: "this is somethin creator"

Solution

Use a negative lookbehind ?<!\\\\${annotation} to not match escaped annotations. The previous regex used to match any character before @author and would replace it with " author".

I have also added a couple of new tests to test the search and replace functionality.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.91%. Comparing base (a026f67) to head (b875739).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #735 +/- ## ======================================= Coverage 92.91% 92.91% ======================================= Files 110 110 Lines 2878 2878 Branches 577 577 ======================================= Hits 2674 2674 Misses 185 185 Partials 19 19 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 6 months ago

:tada: This PR is included in version 2.17.6 :tada:

The release is available on:

Your semantic-release bot :package::rocket: