Skip to content

Commit dcb1beb

Browse files
committed
Pull request without clone
1 parent 267c9b9 commit dcb1beb

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/execute/install-prettier.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ export async function installPrettier(prettierVersion: PrettierVersion) {
3434

3535
await pullRequestDirectory?.dispatch();
3636

37-
const prettierBinary = path.join(cwd, "node_modules/prettier/bin/prettier.cjs")
38-
assert.equal(fs.existsSync(prettierBinary), true)
37+
const prettierBinary = path.join(
38+
cwd,
39+
"node_modules/prettier/bin/prettier.cjs",
40+
);
41+
assert.equal(fs.existsSync(prettierBinary), true);
3942

4043
return {
4144
dispatch: () => {
@@ -62,12 +65,12 @@ async function getPullRequest(
6265

6366
const directory = await createTemporaryDirectory();
6467

65-
await git.clone(
66-
"https://github.com/prettier/prettier.git",
67-
"prettier",
68-
directory.path,
68+
const cwd = directory.path;
69+
await git.init(cwd);
70+
await git.runGit(
71+
["remote", "add", "origin", "https://github.com/prettier/prettier.git"],
72+
{ cwd },
6973
);
70-
const cwd = path.join(directory.path, "prettier");
7174

7275
await gh.prCheckout(pullRequestNumber, cwd);
7376
const { stdout } = await npm.pack({ cwd });

src/tools/git.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import spawn from "nano-spawn";
1+
import spawn, { type Options } from "nano-spawn";
22
import path from "path";
33
import fs from "fs/promises";
44

@@ -100,3 +100,7 @@ export async function shallowClone(
100100
await fetchDepth1("origin", commit, cwd);
101101
await checkout("FETCH_HEAD", cwd);
102102
}
103+
104+
export async function runGit(argv: string[], options: Options) {
105+
return spawn("git", argv, options);
106+
}

0 commit comments

Comments
 (0)