From 817697763db77b0885a8448c5748abe77a1f4fea Mon Sep 17 00:00:00 2001 From: Dominic Saadi Date: Tue, 27 Feb 2024 10:23:28 -0800 Subject: [PATCH] work on ci --- .github/workflows/ci.yml | 7 ------- lib/cwd.ts | 14 ++++++++++---- release/run.ts | 2 +- scripts/reset_next.ts | 2 +- triage/lib/resolve_symmetric_difference.test.ts | 4 ++-- triage/lib/triage.test.ts | 8 ++++---- triage/run.ts | 2 +- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 638d57f..f386b6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,13 +39,6 @@ jobs: fetch-depth: 0 path: redwood - - name: ls - run: | - pwd && echo - ls && echo - ls && echo - ls ../ - - name: 🧪 Test run: cd release-tooling && yarn test ./triage env: diff --git a/lib/cwd.ts b/lib/cwd.ts index f8c9531..40f34cc 100755 --- a/lib/cwd.ts +++ b/lib/cwd.ts @@ -1,12 +1,18 @@ -import { cd } from "zx" +import { cd, fs } from "zx" import { CustomError } from './error.js' -export function setCwd() { - const RWFW_PATH = process.env.RWFW_PATH; +export async function setCwd() { + let RWFW_PATH = process.env.RWFW_PATH; if (!RWFW_PATH) { - throw new CustomError("RWFW_PATH isn't set. Set it to the path of the Redwood monorepo."); + throw new CustomError("`RWFW_PATH` isn't set. Set it to the path of the Redwood monorepo."); + } + + try { + RWFW_PATH = await fs.realpath(RWFW_PATH) + } catch (error) { + throw new CustomError(`\`RWFW_PATH\` is set to "${RWFW_PATH}" but it doesn't exist at that path.`) } const originalCwd = process.cwd() diff --git a/release/run.ts b/release/run.ts index c2ce801..aa6ef34 100644 --- a/release/run.ts +++ b/release/run.ts @@ -9,7 +9,7 @@ import { assertNoNoMilestonePrs } from './lib/milestones.js' import { release } from './lib/release.js' try { - setCwd() + await setCwd() await assertWorkTreeIsClean() await assertNoNoMilestonePrs() diff --git a/scripts/reset_next.ts b/scripts/reset_next.ts index c6d7574..50da470 100644 --- a/scripts/reset_next.ts +++ b/scripts/reset_next.ts @@ -9,7 +9,7 @@ import { REMOTE } from '@lib/github.js' import { resIsYes } from '@lib/prompts.js' if (resIsYes(await question('Ok to reset next to origin/next? [Y/n] > '))) { - setCwd() + await setCwd() await $`git switch next` await $`git fetch ${REMOTE}` await $`git reset --hard ${REMOTE}/next` diff --git a/triage/lib/resolve_symmetric_difference.test.ts b/triage/lib/resolve_symmetric_difference.test.ts index 8a19481..d2587ec 100755 --- a/triage/lib/resolve_symmetric_difference.test.ts +++ b/triage/lib/resolve_symmetric_difference.test.ts @@ -9,8 +9,8 @@ $.verbose = false describe('resolveSymmetricDifference', () => { let resetCwd: () => void - beforeAll(() => { - resetCwd = setCwd() + beforeAll(async () => { + resetCwd = await setCwd() }) afterAll(() => { resetCwd() diff --git a/triage/lib/triage.test.ts b/triage/lib/triage.test.ts index cf3defb..3816b15 100755 --- a/triage/lib/triage.test.ts +++ b/triage/lib/triage.test.ts @@ -38,8 +38,8 @@ test('defaultGitLogOptions', () => { describe('getSymmetricDifference', () => { let resetCwd: () => void - beforeAll(() => { - resetCwd = setCwd() + beforeAll(async () => { + resetCwd = await setCwd() }) afterAll(() => { resetCwd() @@ -271,8 +271,8 @@ test('lineIsChore', () => { describe('resolveLine', async () => { let resetCwd: () => void - beforeAll(() => { - resetCwd = setCwd() + beforeAll(async () => { + resetCwd = await setCwd() }) afterAll(() => { resetCwd() diff --git a/triage/run.ts b/triage/run.ts index bd2fee2..ff1191b 100755 --- a/triage/run.ts +++ b/triage/run.ts @@ -8,7 +8,7 @@ import { getOptions } from './lib/options.js' import { triageRange } from "./lib/triage.js"; try { - setCwd() + await setCwd() await assertWorkTreeIsClean() const options = await getOptions()