Skip to content

Commit 9d96020

Browse files
committed
fix(ci): force repo-root cwd for resilient/retry runners
1 parent 6dc9df0 commit 9d96020

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

scripts/ci-resilient.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import { spawn } from "node:child_process";
33
import { appendFileSync, mkdirSync } from "node:fs";
44
import path from "node:path";
55
import { ensurePythonAliasEnv } from "./python-runtime.mjs";
6-
import { resolveFromRepo } from "./runtime-paths.mjs";
6+
import {
7+
resolveFromRepo,
8+
resolveRepoRootFromMetaUrl,
9+
} from "./runtime-paths.mjs";
710

811
const DEFAULT_SIGNATURES_RELATIVE_PATH =
912
"apps/dashboard/data/ci-signatures.jsonl";
13+
const REPO_ROOT = resolveRepoRootFromMetaUrl(import.meta.url) || process.cwd();
1014

1115
function resolveSignaturesPath() {
1216
if (process.env.CI_SIGNATURES_JSONL_PATH) {
@@ -30,6 +34,7 @@ function run(command, args, label, env = process.env) {
3034
const child = spawn(command, args, {
3135
stdio: ["inherit", "pipe", "pipe"],
3236
env,
37+
cwd: REPO_ROOT,
3338
shell: process.platform === "win32",
3439
});
3540
child.stdout.on("data", (chunk) => {

scripts/ci-retry.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env node
22
import { spawn } from "node:child_process";
3+
import { resolveRepoRootFromMetaUrl } from "./runtime-paths.mjs";
4+
5+
const REPO_ROOT = resolveRepoRootFromMetaUrl(import.meta.url) || process.cwd();
36

47
const maxAttempts = Math.max(
58
1,
@@ -15,6 +18,7 @@ function runCiOnce() {
1518
const child = spawn("npm", ["run", "ci:resilient"], {
1619
stdio: "inherit",
1720
env: process.env,
21+
cwd: REPO_ROOT,
1822
shell: process.platform === "win32",
1923
});
2024
child.on("close", (code, signal) => {

scripts/ci.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
#!/usr/bin/env node
22
import { spawn } from "node:child_process";
33
import { ensurePythonAliasEnv } from "./python-runtime.mjs";
4+
import { resolveRepoRootFromMetaUrl } from "./runtime-paths.mjs";
5+
6+
const REPO_ROOT = resolveRepoRootFromMetaUrl(import.meta.url) || process.cwd();
47

58
function run(command, args, env = process.env) {
69
return new Promise((resolve) => {
710
const child = spawn(command, args, {
811
stdio: "inherit",
912
env,
13+
cwd: REPO_ROOT,
1014
shell: process.platform === "win32",
1115
});
1216
child.on("close", (code, signal) => {

0 commit comments

Comments
 (0)