fix: Dont use glob for index delete.

This commit is contained in:
Miles Johnson 2023-04-17 16:13:01 -07:00
parent d939750e00
commit 63072407f0
2 changed files with 10 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "@moonrepo/setup-rust", "name": "@moonrepo/setup-rust",
"version": "0.3.3", "version": "0.3.4",
"description": "A GitHub action for setting up Rust and Cargo.", "description": "A GitHub action for setting up Rust and Cargo.",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {

View file

@ -61,16 +61,19 @@ export async function cleanCargoRegistry() {
await exec.exec('cargo', ['cache', '--autoclean']); await exec.exec('cargo', ['cache', '--autoclean']);
// .cargo/registry/index - Delete .cache directories // .cargo/registry/index - Delete .cache directories
const globber = await glob.create(path.join(registryDir, 'index/*/.cache')); const indexDir = path.join(registryDir, 'index');
for await (const file of globber.globGenerator()) { for (const index of fs.readdirSync(indexDir)) {
if (fs.existsSync(path.join(path.dirname(file), '.git'))) { if (fs.existsSync(path.join(indexDir, index, '.git'))) {
core.debug(`Deleting ${file}`); const dir = path.join(indexDir, index, '.cache');
core.debug(`Deleting ${dir}`);
try { try {
await io.rmRF(file); // eslint-disable-next-line no-await-in-loop
await io.rmRF(dir);
} catch (error: unknown) { } catch (error: unknown) {
core.warning(`Failed to delete ${file}: ${error}`); core.warning(`Failed to delete ${dir}: ${error}`);
} }
} }
} }