3
0
Fork 0
mirror of https://github.com/Swatinem/rust-cache synced 2025-06-19 06:43:41 +00:00

avoid calling cargo metadata on pre-cleanup

This commit is contained in:
Arpad Borsos 2022-11-03 11:26:22 +01:00
parent 19c46583c5
commit 3f2513fdf4
No known key found for this signature in database
GPG key ID: 570F20163159CB55
6 changed files with 63 additions and 40 deletions

View file

@ -1,3 +1,4 @@
import * as core from "@actions/core";
import path from "path";
import { getCmdOutput } from "./utils";
@ -10,11 +11,13 @@ export class Workspace {
public async getPackages(): Promise<Packages> {
let packages: Packages = [];
try {
core.debug(`collecting metadata for "${this.root}"`);
const meta: Meta = JSON.parse(
await getCmdOutput("cargo", ["metadata", "--all-features", "--format-version", "1"], {
cwd: this.root,
}),
);
core.debug(`workspace "${this.root}" has ${meta.packages.length} packages`);
for (const pkg of meta.packages) {
if (pkg.manifest_path.startsWith(this.root)) {
continue;