Skip to content

Commit caed5d0

Browse files
authored
Update lint.yaml
1 parent a146165 commit caed5d0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎.github/workflows/lint.yaml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,14 @@ jobs:
140140
uses: actions/checkout@v5
141141

142142
# --enrich all: syft fills in Go/Java/JS/Python licenses from package registries.
143+
# syft reads Rust dependencies only from Cargo.lock; applications and libraries
144+
# often keep it out of git, so it is generated for the scan when missing.
143145
- name: SBOM
144146
run: |
147+
if [ -f Cargo.toml ] && [ ! -f Cargo.lock ]; then
148+
echo "No Cargo.lock in the repository: generating it for the scan"
149+
cargo generate-lockfile
150+
fi
145151
mkdir -p "$RUNNER_TEMP/sbom"
146152
docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp \
147153
-v "$GITHUB_WORKSPACE:/src:ro" -v "$RUNNER_TEMP/sbom:/out" -w /src \
@@ -282,6 +288,10 @@ jobs:
282288
ok = allow.get(f"{name}@{ver}", allow.get(name))
283289
rows.append((level, name, ver, lic or "—", eco.group(1) if eco else c.get("type", ""), ok))
284290
rows.sort(key=lambda r: (-r[0], r[1].lower()))
291+
if not rows:
292+
# An empty SBOM usually means no lock files (package-lock.json, poetry.lock,
293+
# go.sum…): nothing was really checked, so say it instead of a silent pass.
294+
print("::warning::SBOM is empty: no dependencies found (no lock files?)")
285295
286296
counts = {k: sum(1 for r in rows if NAME[r[0]] == k) for k in ("CRITICAL", "HIGH", "MEDIUM", "UNKNOWN", "LOW")}
287297
blocking = [r for r in rows if r[0] >= LEVEL["HIGH"] and r[5] is None]

0 commit comments

Comments
 (0)