@@ -16,6 +16,7 @@ interface Options {
16
16
releaseCommit : string ;
17
17
// Even it is specified as boolean, it would still be parsed as string in compiled js.
18
18
dryRun : string ;
19
+ githubPAT : string | null ;
19
20
}
20
21
21
22
gulp . task ( 'createTags:roslyn' , async ( ) : Promise < void > => {
@@ -71,7 +72,7 @@ async function createTagsAsync(
71
72
) : Promise < void > {
72
73
console . log ( `releaseVersion: ${ options . releaseVersion } ` ) ;
73
74
console . log ( `releaseCommit: ${ options . releaseCommit } ` ) ;
74
- const dryRun = options . dryRun . toLocaleLowerCase ( ) === 'true' ;
75
+ const dryRun = options . dryRun ? options . dryRun . toLocaleLowerCase ( ) === 'true' : false ;
75
76
console . log ( `dry run: ${ dryRun } ` ) ;
76
77
77
78
const commit = await getCommit ( ) ;
@@ -86,7 +87,7 @@ async function createTagsAsync(
86
87
return ;
87
88
} else {
88
89
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 ) ;
90
91
91
92
if ( ! tagCreated ) {
92
93
logError ( `Failed to tag '${ owner } /${ repo } '` ) ;
@@ -102,11 +103,12 @@ async function tagRepoAsync(
102
103
repo : string ,
103
104
commit : string ,
104
105
releaseTag : string ,
105
- tagMessage : string
106
+ tagMessage : string ,
107
+ githubPAT : string | null
106
108
) : Promise < boolean > {
107
- const pat = process . env [ 'GitHubPAT' ] ;
109
+ const pat = githubPAT ?? process . env [ 'GitHubPAT' ] ;
108
110
if ( ! pat ) {
109
- throw 'No GitHub Pat found.' ;
111
+ throw 'No GitHub Pat found. Specify with --githubPAT or set GitHubPAT environment variable. ' ;
110
112
}
111
113
112
114
console . log ( `Start to tag ${ owner } /${ repo } . Commit: ${ commit } , tag: ${ releaseTag } , message: ${ tagMessage } ` ) ;
0 commit comments