From f1cd74dff640a9041fae5b8842fdbc27e0923f3c Mon Sep 17 00:00:00 2001 From: Toph Tucker Date: Fri, 1 Nov 2024 21:27:25 -0700 Subject: [PATCH] setting name and email config for git, seeing if that helps --- src/deploy.ts | 4 +++- test/deploy-test.ts | 2 +- test/mocks/directory.ts | 22 ++++++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/deploy.ts b/src/deploy.ts index b4f6cb666..2cb26cb61 100644 --- a/src/deploy.ts +++ b/src/deploy.ts @@ -279,7 +279,9 @@ class Deployer { if (!isGit) throw new CliError("Not at root of a git repository."); const {ownerName, repoName} = await getGitHubRemote(); - const branch = (await promisify(exec)("git rev-parse --abbrev-ref HEAD")).stdout.trim(); + const a = (await promisify(exec)("git rev-parse --abbrev-ref HEAD")); + console.log("validateGitHubLink", {stdout: a.stdout, stderr: a.stderr}); + const branch = a.stdout.trim(); let localRepo = await this.apiClient.getGitHubRepository({ownerName, repoName}); // If a source repository has already been configured, check that it’s diff --git a/test/deploy-test.ts b/test/deploy-test.ts index 8352d0078..6259f90d7 100644 --- a/test/deploy-test.ts +++ b/test/deploy-test.ts @@ -260,7 +260,7 @@ describe("deploy", () => { const {stdout, stderr} = await promisify(exec)( "touch readme.md; git add .; git commit -m 'initial'; git remote add origin git@github.com:observablehq/test.git" ); - console.log({stdout, stderr}); + console.log("starts cloud build test", {stdout, stderr}); await deploy(TEST_OPTIONS, effects); diff --git a/test/mocks/directory.ts b/test/mocks/directory.ts index e75622d21..dbb6cb0e4 100644 --- a/test/mocks/directory.ts +++ b/test/mocks/directory.ts @@ -1,10 +1,10 @@ -import { exec } from "child_process"; -import { mkdtemp, rm } from "fs/promises"; -import { tmpdir } from "os"; -import { join } from "path/posix"; -import { promisify } from "util"; +import {exec} from "child_process"; +import {mkdtemp, rm} from "fs/promises"; +import {tmpdir} from "os"; +import {join} from "path/posix"; +import {promisify} from "util"; -export function mockIsolatedDirectory({ git }: { git: boolean; }) { +export function mockIsolatedDirectory({git}: {git: boolean}) { let dir: string; let cwd: string; beforeEach(async () => { @@ -13,15 +13,17 @@ export function mockIsolatedDirectory({ git }: { git: boolean; }) { process.chdir(dir); if (git) { console.log("logging stdout, stderr"); - const a = (await promisify(exec)("git config --global init.defaultBranch main")) + const a = await promisify(exec)( + "git config --global user.email \"you@example.com\"; git config --global user.name \"Your Name\"; git config --global init.defaultBranch main" + ); console.log(a.stdout, a.stderr); - const b = (await promisify(exec)("git init")); + const b = await promisify(exec)("git init"); console.log(b.stdout, b.stderr); - }; + } }); afterEach(async () => { process.chdir(cwd); - await rm(dir, { recursive: true }); + await rm(dir, {recursive: true}); }); }