Skip to content

Commit 5fc7bd5

Browse files
committed
Fix commitChanges
1 parent 537f560 commit 5fc7bd5

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

scripts/utilities.mjs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
import * as prettier from "prettier";
2-
import fs from "fs/promises";
3-
import spawn from "nano-spawn";
4-
import repositories from "../repositories.json" with { type: "json" };
5-
6-
export const REPOSITORIES_JSON_FILE = new URL(
7-
"../repositories.json",
8-
import.meta.url,
9-
);
10-
11-
export async function getRepositoryCommitHash(repository) {
12-
const { stdout } = await spawn("git", [
13-
"ls-remote",
14-
"--exit-code",
15-
`https://github.com/${repository}`,
16-
"HEAD",
17-
]);
18-
19-
const [commit] = stdout.trim().split(/\s/);
20-
return commit;
21-
}
22-
23-
export async function updatedRepositories(processFunction) {
24-
const updated = await processFunction(repositories);
25-
26-
await fs.writeFile(
27-
REPOSITORIES_JSON_FILE,
28-
await prettier.format(JSON.stringify(updated), { parser: "json" }),
29-
);
30-
}
1+
import * as prettier from "prettier";
2+
import fs from "fs/promises";
3+
import spawn from "nano-spawn";
4+
import repositories from "../repositories.json" with { type: "json" };
5+
6+
export const REPOSITORIES_JSON_FILE = new URL(
7+
"../repositories.json",
8+
import.meta.url,
9+
);
10+
11+
export async function getRepositoryCommitHash(repository) {
12+
const { stdout } = await spawn("git", [
13+
"ls-remote",
14+
"--exit-code",
15+
`https://github.com/${repository}`,
16+
"HEAD",
17+
]);
18+
19+
const [commit] = stdout.trim().split(/\s/);
20+
return commit;
21+
}
22+
23+
export async function updatedRepositories(processFunction) {
24+
const updated = await processFunction(repositories);
25+
26+
await fs.writeFile(
27+
REPOSITORIES_JSON_FILE,
28+
await prettier.format(JSON.stringify(updated), { parser: "json" }),
29+
);
30+
}

src/execute/run-prettier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function shouldInstallDependencies(error: SubprocessError) {
4747
}
4848

4949
const commitChanges = async (directory: string, message: string) => {
50-
await spawn("git", ["add", "."]);
50+
await spawn("git", ["add", "."], { cwd: directory });
5151
await spawn(
5252
"git",
5353
["commit", "--allow-empty", "--no-verify", "-m", message],

0 commit comments

Comments
 (0)