Skip to content

Commit 57acfaa

Browse files
committed
chore: avoid altering formatting via jq in manual-release workflow
1 parent ea816c7 commit 57acfaa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/manual-release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ jobs:
6868
echo "❌ Version mismatch in $pkg: $CURRENT_VERSION != $EXPECTED_VERSION"
6969
MISMATCHES_FOUND=true
7070
71-
jq --arg version "$EXPECTED_VERSION" '.version = $version' "$pkg" > "$pkg.tmp" && mv "$pkg.tmp" "$pkg"
71+
# Detect indentation by checking the first property line
72+
INDENT_SPACES=$(head -10 "$pkg" | grep '^ *"' | head -1 | sed 's/".*//g' | wc -c)
73+
INDENT_SPACES=$((INDENT_SPACES - 1))
74+
75+
jq --indent "$INDENT_SPACES" --arg version "$EXPECTED_VERSION" '.version = $version' "$pkg" > "$pkg.tmp" && mv "$pkg.tmp" "$pkg"
7276
echo "✓ Updated $pkg to version $EXPECTED_VERSION"
7377
else
7478
echo "✓ $pkg version matches: $CURRENT_VERSION"

0 commit comments

Comments
 (0)