File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ export class GithubHelper {
159159 owner : this . githubOwner ,
160160 repo : this . githubRepo ,
161161 state : 'all' ,
162+ labels : 'gitlab merge request' ,
162163 per_page : perPage ,
163164 page : page ,
164165 } ) ;
Original file line number Diff line number Diff line change @@ -561,8 +561,12 @@ async function transferMergeRequests() {
561561 i => i . title . trim ( ) === mr . title . trim ( )
562562 ) ;
563563 let githubIssue = githubIssues . find (
564- // allow for issues titled "Original Issue Name [merged]"
565- i => i . title . trim ( ) . includes ( mr . title . trim ( ) )
564+ // allow for issues titled "Original Issue Name - [merged|closed]"
565+ i => {
566+ // regex needs escaping in case merge request title contains special characters
567+ const regex = new RegExp ( escapeRegExp ( mr . title . trim ( ) ) + ' - \\[(merged|closed)\\]' ) ;
568+ return regex . test ( i . title . trim ( ) ) ;
569+ }
566570 ) ;
567571 if ( ! githubRequest && ! githubIssue ) {
568572 if ( settings . skipMergeRequestStates . includes ( mr . state ) ) {
@@ -716,3 +720,7 @@ function inform(msg: string) {
716720 console . log ( msg ) ;
717721 console . log ( '==================================' ) ;
718722}
723+
724+ function escapeRegExp ( string ) {
725+ return string . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) ; // $& means the whole matched string
726+ }
You can’t perform that action at this time.
0 commit comments