switch to start_dependency_installation and await_dependency_installation, fix action play.ts repo
This commit is contained in:
+6
-27
@@ -9,42 +9,21 @@ import { $ } from "./shell.ts";
|
||||
|
||||
export interface SetupOptions {
|
||||
tempDir: string;
|
||||
forceClean?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the test repository for running actions
|
||||
*/
|
||||
export function setupTestRepo(options: SetupOptions): void {
|
||||
const { tempDir, forceClean = false } = options;
|
||||
|
||||
const { tempDir } = options;
|
||||
const repo = process.env.GITHUB_REPOSITORY;
|
||||
if (!repo) {
|
||||
throw new Error(
|
||||
"GITHUB_REPOSITORY environment variable must be specified (e.g. pullfrog/scratch)"
|
||||
);
|
||||
}
|
||||
|
||||
const cloneUrl = `git@github.com:${repo}.git`;
|
||||
|
||||
if (!repo) throw new Error("GITHUB_REPOSITORY is required");
|
||||
if (existsSync(tempDir)) {
|
||||
if (forceClean) {
|
||||
log.info("» removing existing .temp directory...");
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
|
||||
log.info(`» cloning ${repo} into .temp...`);
|
||||
$("git", ["clone", cloneUrl, tempDir]);
|
||||
} else {
|
||||
log.info("» resetting existing .temp repository...");
|
||||
execSync("git reset --hard HEAD && git clean -fd", {
|
||||
cwd: tempDir,
|
||||
stdio: "inherit",
|
||||
});
|
||||
}
|
||||
} else {
|
||||
log.info(`» cloning ${repo} into .temp...`);
|
||||
$("git", ["clone", cloneUrl, tempDir]);
|
||||
log.info("» removing existing .temp directory...");
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
log.info(`» cloning ${repo} into .temp...`);
|
||||
$("git", ["clone", `git@github.com:${repo}.git`, tempDir]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user