From 0fe2d02acf043f70d369a7d230a29e7b8154aa85 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Sat, 27 Jul 2024 18:04:38 -0500 Subject: [PATCH] feat(nx-ghpages): add support for passing GH_TOKEN or GITHUB_TOKEN via env to auth with remote --- packages/nx-ghpages/src/executors/deploy/executor.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/nx-ghpages/src/executors/deploy/executor.ts b/packages/nx-ghpages/src/executors/deploy/executor.ts index 8e1a473f..4e8a4a79 100644 --- a/packages/nx-ghpages/src/executors/deploy/executor.ts +++ b/packages/nx-ghpages/src/executors/deploy/executor.ts @@ -30,6 +30,13 @@ export default async function deployExecutor(options: BuildExecutorSchema) { logger.info(`Creating CNAME file for ${options.CNAME} in ${directory}`); writeFileSync(join(directory, 'CNAME'), options.CNAME); } + const envToken = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN; + if (envToken) { + options.remote = options.remote.replace( + 'https://', + `https://github-actions:${envToken}@`, + ); + } logger.info('Setting up git remote');