@@ -55,16 +55,16 @@ const couldNotFindMessage = txt`
5555` ;
5656
5757const errorsGettingOwners = ( str : string ) => txt `
58- |Hi, we could not find [${ str } ] in DefinitelyTyped, is there possibly a typo?
58+ |Hi, we could not find [\` ${ str } \` ] in DefinitelyTyped, is there possibly a typo?
5959` ;
6060
6161const couldNotFindOwners = ( str : string ) => txt `
62- |Hi, we had an issue getting the owners for [${ str } ] - first check if you have a typeo, otherwise please raise an issue on
62+ |Hi, we had an issue getting the owners for [\` ${ str } \` ] - first check if you have a typeo, otherwise please raise an issue on
6363 |microsoft/DefinitelyTyped-tools if the module exists on DT but this bot could not find information for it.
6464` ;
6565
6666const gotAReferenceMessage = ( module : string , owners : string [ ] ) => txt `
67- |Thanks for the discussion about "${ module } ", some useful links for everyone:
67+ |Thanks for the discussion about "\` ${ module } \` ", some useful links for everyone:
6868 |
6969 | - [npm](https://www.npmjs.com/package/${ module } )
7070 | - [DT](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/${ module } )
@@ -87,8 +87,11 @@ async function pingAuthorsAndSetUpDiscussion(discussion: Discussion) {
8787 } else {
8888 const message = gotAReferenceMessage ( aboutNPMRef , owners ) ;
8989 await updateOrCreateMainComment ( discussion , message ) ;
90+ // Only create a label once we've confirmed the package actually exists on DT --
91+ // otherwise an unprivileged user could make typescript-bot create arbitrarily-named
92+ // repository labels by editing the discussion title.
93+ await addLabel ( discussion , "Pkg: " + aboutNPMRef , `Discussions related to ${ aboutNPMRef } ` ) ;
9094 }
91- await addLabel ( discussion , "Pkg: " + aboutNPMRef , `Discussions related to ${ aboutNPMRef } ` ) ;
9295 }
9396 return { status : 200 , body : "OK" } ;
9497}
0 commit comments