From 80c47cc945af2ab1ffb6e13684fe0dcbce0c186a Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Wed, 2 Aug 2023 12:54:48 +0200 Subject: [PATCH] Clean up `credentials.toml` --- dist/restore/index.js | 7 +++++++ dist/save/index.js | 7 +++++++ src/cleanup.ts | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/dist/restore/index.js b/dist/restore/index.js index eebd8a5..b888c6a 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -67272,6 +67272,13 @@ async function cleanBin(oldBins) { } } async function cleanRegistry(packages, crates = true) { + // remove `.cargo/credentials.toml` + try { + const credentials = path.join(CARGO_HOME, ".cargo", "credentials.toml"); + core.debug(`deleting "${credentials}"`); + await fs.promises.unlink(credentials); + } + catch { } // `.cargo/registry/index` let pkgSet = new Set(packages.map((p) => p.name)); const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index")); diff --git a/dist/save/index.js b/dist/save/index.js index 306cf3a..8a1e3e9 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -67272,6 +67272,13 @@ async function cleanBin(oldBins) { } } async function cleanRegistry(packages, crates = true) { + // remove `.cargo/credentials.toml` + try { + const credentials = external_path_default().join(CARGO_HOME, ".cargo", "credentials.toml"); + core.debug(`deleting "${credentials}"`); + await external_fs_default().promises.unlink(credentials); + } + catch { } // `.cargo/registry/index` let pkgSet = new Set(packages.map((p) => p.name)); const indexDir = await external_fs_default().promises.opendir(external_path_default().join(CARGO_HOME, "registry", "index")); diff --git a/src/cleanup.ts b/src/cleanup.ts index 6f7327c..6b401f3 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -91,6 +91,13 @@ export async function cleanBin(oldBins: Array) { } export async function cleanRegistry(packages: Packages, crates = true) { + // remove `.cargo/credentials.toml` + try { + const credentials = path.join(CARGO_HOME, ".cargo", "credentials.toml"); + core.debug(`deleting "${credentials}"`); + await fs.promises.unlink(credentials); + } catch {} + // `.cargo/registry/index` let pkgSet = new Set(packages.map((p) => p.name)); const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index"));