@@ -16,6 +16,7 @@ interface Options {
1616 releaseCommit : string ;
1717 // Even it is specified as boolean, it would still be parsed as string in compiled js.
1818 dryRun : string ;
19+ githubPAT : string | null ;
1920}
2021
2122gulp . task ( 'createTags:roslyn' , async ( ) : Promise < void > => {
@@ -71,7 +72,7 @@ async function createTagsAsync(
7172) : Promise < void > {
7273 console . log ( `releaseVersion: ${ options . releaseVersion } ` ) ;
7374 console . log ( `releaseCommit: ${ options . releaseCommit } ` ) ;
74- const dryRun = options . dryRun . toLocaleLowerCase ( ) === 'true' ;
75+ const dryRun = options . dryRun ? options . dryRun . toLocaleLowerCase ( ) === 'true' : false ;
7576 console . log ( `dry run: ${ dryRun } ` ) ;
7677
7778 const commit = await getCommit ( ) ;
@@ -86,7 +87,7 @@ async function createTagsAsync(
8687 return ;
8788 } else {
8889 const [ tag , message ] = getTagAndMessage ( options . releaseVersion ) ;
89- const tagCreated = await tagRepoAsync ( owner , repo , commit , tag , message ) ;
90+ const tagCreated = await tagRepoAsync ( owner , repo , commit , tag , message , options . githubPAT ) ;
9091
9192 if ( ! tagCreated ) {
9293 logError ( `Failed to tag '${ owner } /${ repo } '` ) ;
@@ -102,11 +103,12 @@ async function tagRepoAsync(
102103 repo : string ,
103104 commit : string ,
104105 releaseTag : string ,
105- tagMessage : string
106+ tagMessage : string ,
107+ githubPAT : string | null
106108) : Promise < boolean > {
107- const pat = process . env [ 'GitHubPAT' ] ;
109+ const pat = githubPAT ?? process . env [ 'GitHubPAT' ] ;
108110 if ( ! pat ) {
109- throw 'No GitHub Pat found.' ;
111+ throw 'No GitHub Pat found. Specify with --githubPAT or set GitHubPAT environment variable. ' ;
110112 }
111113
112114 console . log ( `Start to tag ${ owner } /${ repo } . Commit: ${ commit } , tag: ${ releaseTag } , message: ${ tagMessage } ` ) ;
0 commit comments