Clean up credentials.toml

This commit is contained in:
Arpad Borsos 2023-08-02 12:54:48 +02:00
parent 5ec9842c14
commit 80c47cc945
No known key found for this signature in database
GPG Key ID: FC7BCA77824B3298
3 changed files with 21 additions and 0 deletions

View File

@ -67272,6 +67272,13 @@ async function cleanBin(oldBins) {
} }
} }
async function cleanRegistry(packages, crates = true) { 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` // `.cargo/registry/index`
let pkgSet = new Set(packages.map((p) => p.name)); let pkgSet = new Set(packages.map((p) => p.name));
const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index")); const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index"));

7
dist/save/index.js vendored
View File

@ -67272,6 +67272,13 @@ async function cleanBin(oldBins) {
} }
} }
async function cleanRegistry(packages, crates = true) { 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` // `.cargo/registry/index`
let pkgSet = new Set(packages.map((p) => p.name)); 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")); const indexDir = await external_fs_default().promises.opendir(external_path_default().join(CARGO_HOME, "registry", "index"));

View File

@ -91,6 +91,13 @@ export async function cleanBin(oldBins: Array<string>) {
} }
export async function cleanRegistry(packages: Packages, crates = true) { 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` // `.cargo/registry/index`
let pkgSet = new Set(packages.map((p) => p.name)); let pkgSet = new Set(packages.map((p) => p.name));
const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index")); const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index"));