From 58bb5f2c2cf6bd9bdc363a3c062276a1f59e8859 Mon Sep 17 00:00:00 2001 From: Erick Bourgeois Date: Sun, 21 Dec 2025 13:22:12 -0500 Subject: [PATCH] Use compgen instead of ls Signed-off-by: Erick Bourgeois --- rust/generate-sbom/action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/generate-sbom/action.yaml b/rust/generate-sbom/action.yaml index 14acbbf..1778880 100644 --- a/rust/generate-sbom/action.yaml +++ b/rust/generate-sbom/action.yaml @@ -117,7 +117,8 @@ runs: # Find all Cargo.toml files (excluding target dirs and root if workspace) find . -name "Cargo.toml" -not -path "*/target/*" -not -path "*/.git/*" | while read cargo_file; do crate_dir=$(dirname "$cargo_file") - if ls "$crate_dir"/*.cdx.* 2>/dev/null; then + # Check if SBOMs exist in this directory before trying to list them + if compgen -G "$crate_dir/*.cdx.*" > /dev/null 2>&1; then echo "" echo "SBOMs in $crate_dir:" ls -lh "$crate_dir"/*.cdx.*