mirror of
https://github.com/github/codeql-action.git
synced 2026-04-29 18:30:14 +00:00
Use Node fs APIs instead of del
This commit is contained in:
+6
-13
@@ -6,7 +6,6 @@ import * as core from "@actions/core";
|
||||
import * as exec from "@actions/exec/lib/exec";
|
||||
import * as io from "@actions/io";
|
||||
import checkDiskSpace from "check-disk-space";
|
||||
import * as del from "del";
|
||||
import getFolderSize from "get-folder-size";
|
||||
import * as yaml from "js-yaml";
|
||||
import * as semver from "semver";
|
||||
@@ -167,7 +166,7 @@ export async function withTmpDir<T>(
|
||||
): Promise<T> {
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "codeql-action-"));
|
||||
const result = await body(tmpDir);
|
||||
await del.deleteAsync(tmpDir, { force: true });
|
||||
await fs.promises.rm(tmpDir, { force: true, recursive: true });
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -756,7 +755,7 @@ export async function bundleDb(
|
||||
// from somewhere else or someone trying to make the action upload a
|
||||
// non-database file.
|
||||
if (fs.existsSync(databaseBundlePath)) {
|
||||
await del.deleteAsync(databaseBundlePath, { force: true });
|
||||
await fs.promises.rm(databaseBundlePath, { force: true });
|
||||
}
|
||||
await codeql.databaseBundle(databasePath, databaseBundlePath, dbName);
|
||||
return databaseBundlePath;
|
||||
@@ -1266,16 +1265,10 @@ export async function checkSipEnablement(
|
||||
export async function cleanUpGlob(glob: string, name: string, logger: Logger) {
|
||||
logger.debug(`Cleaning up ${name}.`);
|
||||
try {
|
||||
const deletedPaths = await del.deleteAsync(glob, { force: true });
|
||||
if (deletedPaths.length === 0) {
|
||||
logger.warning(
|
||||
`Failed to clean up ${name}: no files found matching ${glob}.`,
|
||||
);
|
||||
} else if (deletedPaths.length === 1) {
|
||||
logger.debug(`Cleaned up ${name}.`);
|
||||
} else {
|
||||
logger.debug(`Cleaned up ${name} (${deletedPaths.length} files).`);
|
||||
}
|
||||
await fs.promises.rm(glob, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
});
|
||||
} catch (e) {
|
||||
logger.warning(`Failed to clean up ${name}: ${e}.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user