mirror of
https://github.com/moonrepo/setup-rust.git
synced 2025-04-20 01:28:43 +00:00
fix: Dont error on missing index dir.
This commit is contained in:
parent
aaa9e56585
commit
8e43d3720d
2 changed files with 12 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@moonrepo/setup-rust",
|
||||
"version": "0.3.5",
|
||||
"version": "0.3.6",
|
||||
"description": "A GitHub action for setting up Rust and Cargo.",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
|
|
20
src/cargo.ts
20
src/cargo.ts
|
@ -132,17 +132,19 @@ export async function cleanCargoRegistry() {
|
|||
// .cargo/registry/index - Delete .cache directories
|
||||
const indexDir = path.join(registryDir, 'index');
|
||||
|
||||
for (const index of fs.readdirSync(indexDir)) {
|
||||
if (fs.existsSync(path.join(indexDir, index, '.git'))) {
|
||||
const dir = path.join(indexDir, index, '.cache');
|
||||
if (fs.existsSync(indexDir)) {
|
||||
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}`);
|
||||
core.debug(`Deleting ${dir}`);
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await io.rmRF(dir);
|
||||
} catch (error: unknown) {
|
||||
core.warning(`Failed to delete ${dir}: ${error}`);
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await io.rmRF(dir);
|
||||
} catch (error: unknown) {
|
||||
core.warning(`Failed to delete ${dir}: ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue