Skip to content

Commit 624a6d4

Browse files
yannhamclaude
andcommitted
fix(ci): handle new crate addition in semver-check
When a crate doesn't exist in the baseline, cargo-semver-checks exits with code 1 and "package not found". Treat this as a minor change instead of an error. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent d88e70e commit 624a6d4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/semver-level.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ compute_semver_results() {
8585
DETAILS=$(echo "$SEMVER_OUTPUT" | grep -A 1000 "^--- failure" | head -100 || echo "$SEMVER_OUTPUT" | tail -50)
8686
log_verbose "Detected semver violations (major change)" >&2
8787
log_verbose "$SEMVER_OUTPUT" >&2
88+
elif echo "$SEMVER_OUTPUT" | grep -qF "package \`$crate\` not found"; then
89+
# The crate doesn't exist in the baseline — it's a new crate being added
90+
LEVEL="minor"
91+
REASON="New crate (not present in baseline)"
92+
log_verbose "New crate '$crate' not found in baseline, treating as minor change" >&2
8893
else
8994
echo "Error running cargo-semver-checks: $SEMVER_OUTPUT" >&2
9095
exit $SEMVER_EXIT_CODE

0 commit comments

Comments
 (0)