@@ -60,6 +60,7 @@ const createRelease = async (
6060
6161type PublishOptions = {
6262 script : string ;
63+ githubToken : string ;
6364 octokit : Octokit ;
6465 createGithubReleases : boolean ;
6566 git : Git ;
@@ -79,6 +80,7 @@ type PublishResult =
7980
8081export async function runPublish ( {
8182 script,
83+ githubToken,
8284 git,
8385 octokit,
8486 createGithubReleases,
@@ -89,7 +91,7 @@ export async function runPublish({
8991 let changesetPublishOutput = await getExecOutput (
9092 publishCommand ,
9193 publishArgs ,
92- { cwd }
94+ { cwd, env : { ... process . env , GITHUB_TOKEN : githubToken } }
9395 ) ;
9496
9597 let { packages, tool } = await getPackages ( cwd ) ;
@@ -249,6 +251,7 @@ export async function getVersionPrBody({
249251
250252type VersionOptions = {
251253 script ?: string ;
254+ githubToken : string ;
252255 git : Git ;
253256 octokit : Octokit ;
254257 cwd ?: string ;
@@ -265,6 +268,7 @@ type RunVersionResult = {
265268
266269export async function runVersion ( {
267270 script,
271+ githubToken,
268272 git,
269273 octokit,
270274 cwd = process . cwd ( ) ,
@@ -282,9 +286,11 @@ export async function runVersion({
282286
283287 let versionsByDirectory = await getVersionsByDirectory ( cwd ) ;
284288
289+ const env = { ...process . env , GITHUB_TOKEN : githubToken } ;
290+
285291 if ( script ) {
286292 let [ versionCommand , ...versionArgs ] = script . split ( / \s + / ) ;
287- await exec ( versionCommand , versionArgs , { cwd } ) ;
293+ await exec ( versionCommand , versionArgs , { cwd, env } ) ;
288294 } else {
289295 let changesetsCliPkgJson = requireChangesetsCliPkgJson ( cwd ) ;
290296 let cmd = semverLt ( changesetsCliPkgJson . version , "2.0.0" )
@@ -300,6 +306,7 @@ export async function runVersion({
300306 ] ,
301307 {
302308 cwd,
309+ env,
303310 }
304311 ) ;
305312 }
@@ -330,7 +337,7 @@ export async function runVersion({
330337 /**
331338 * Fetch any existing pull requests that are open against the branch,
332339 * before we push any changes that may inadvertently close the existing PRs.
333- *
340+ *
334341 * (`@changesets/ghcommit` has to reset the branch to the same commit as the base,
335342 * which GitHub will then react to by closing the PRs)
336343 */
@@ -340,7 +347,13 @@ export async function runVersion({
340347 head : `${ github . context . repo . owner } :${ versionBranch } ` ,
341348 base : branch ,
342349 } ) ;
343- core . info ( `Existing pull requests: ${ JSON . stringify ( existingPullRequests . data , null , 2 ) } ` ) ;
350+ core . info (
351+ `Existing pull requests: ${ JSON . stringify (
352+ existingPullRequests . data ,
353+ null ,
354+ 2
355+ ) } `
356+ ) ;
344357
345358 await git . pushChanges ( { branch : versionBranch , message : finalCommitMessage } ) ;
346359
0 commit comments