mirror of
https://github.com/moonrepo/setup-rust.git
synced 2025-04-20 01:28:43 +00:00
fix: Dont use glob for index delete.
This commit is contained in:
parent
d939750e00
commit
63072407f0
2 changed files with 10 additions and 7 deletions
|
@ -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": {
|
||||
|
|
15
src/cargo.ts
15
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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue