Skip to content

Commit 78cc122

Browse files
committed
fix: frozen lock error
1 parent 0a0aac9 commit 78cc122

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/src/shared/git.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import execa from 'execa';
2-
import { copy, pathExists } from 'fs-extra';
2+
import { copy, pathExists, remove } from 'fs-extra';
33
import { updateFile } from './fs';
44
import {
55
getCaseDistPath,
@@ -14,8 +14,13 @@ import { ROOT_PATH } from './constant';
1414
export async function cloneRepo(productName: string, caseName: string) {
1515
const repoName = getRepoName(productName);
1616
const localRepoPath = getRepoPath(repoName);
17+
const { GITHUB_ACTOR, GITHUB_TOKEN, COMMIT_ID, PR_NUMBER } = process.env;
18+
19+
if (PR_NUMBER) {
20+
await remove(localRepoPath);
21+
}
22+
1723
if (!(await pathExists(localRepoPath))) {
18-
const { GITHUB_ACTOR, GITHUB_TOKEN, COMMIT_ID, PR_NUMBER } = process.env;
1924
const repoURL = GITHUB_TOKEN
2025
? `https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/web-infra-dev/${repoName}.git`
2126
: `[email protected]:web-infra-dev/${repoName}.git`;

0 commit comments

Comments
 (0)