diff --git a/package.json b/package.json index 133d7d9..fc7c890 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moonrepo/setup-rust", - "version": "0.3.3", + "version": "0.3.4", "description": "A GitHub action for setting up Rust and Cargo.", "main": "dist/index.js", "scripts": { diff --git a/src/cargo.ts b/src/cargo.ts index ca9314a..1f50784 100644 --- a/src/cargo.ts +++ b/src/cargo.ts @@ -61,16 +61,19 @@ export async function cleanCargoRegistry() { await exec.exec('cargo', ['cache', '--autoclean']); // .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()) { - if (fs.existsSync(path.join(path.dirname(file), '.git'))) { - core.debug(`Deleting ${file}`); + for (const index of fs.readdirSync(indexDir)) { + if (fs.existsSync(path.join(indexDir, index, '.git'))) { + const dir = path.join(indexDir, index, '.cache'); + + core.debug(`Deleting ${dir}`); try { - await io.rmRF(file); + // eslint-disable-next-line no-await-in-loop + await io.rmRF(dir); } catch (error: unknown) { - core.warning(`Failed to delete ${file}: ${error}`); + core.warning(`Failed to delete ${dir}: ${error}`); } } }