Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,57 @@ jobs:
run: |
echo "🔍 Validating vNext components with reference resolution..."

# Temporarily rename diagram files to exclude them from validation
echo "📋 Excluding diagram files from validation..."
DIAGRAM_FILES=$(find core -name "*.diagram.json" -type f 2>/dev/null || true)
if [ -n "$DIAGRAM_FILES" ]; then
echo "$DIAGRAM_FILES" | while read file; do
if [ -f "$file" ]; then
mv "$file" "${file}.skip"
echo " Excluded: $file"
fi
done
else
echo " No diagram files found to exclude"
fi
Comment on lines +96 to +108
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): The echo ... | while read pattern is brittle for filenames with spaces and can be simplified.

echo "$DIAGRAM_FILES" | while read file will split on spaces and special characters, so any diagram path containing them may be processed incorrectly. You can avoid this by iterating directly over find’s output and preserving paths:

find core -name "*.diagram.json" -type f 2>/dev/null | while IFS= read -r file; do
  mv "$file" "${file}.skip"
  echo "  Excluded: $file"
done
Suggested change
# Temporarily rename diagram files to exclude them from validation
echo "📋 Excluding diagram files from validation..."
DIAGRAM_FILES=$(find core -name "*.diagram.json" -type f 2>/dev/null || true)
if [ -n "$DIAGRAM_FILES" ]; then
echo "$DIAGRAM_FILES" | while read file; do
if [ -f "$file" ]; then
mv "$file" "${file}.skip"
echo " Excluded: $file"
fi
done
else
echo " No diagram files found to exclude"
fi
# Temporarily rename diagram files to exclude them from validation
echo "📋 Excluding diagram files from validation..."
DIAGRAM_FILES=$(find core -name "*.diagram.json" -type f 2>/dev/null || true)
if [ -n "$DIAGRAM_FILES" ]; then
find core -name "*.diagram.json" -type f 2>/dev/null | while IFS= read -r file; do
if [ -f "$file" ]; then
mv "$file" "${file}.skip"
echo " Excluded: $file"
fi
done
else
echo " No diagram files found to exclude"
fi


# Run validation with reference resolution
VALIDATION_EXIT_CODE=0
if vnext validate --resolve-refs; then
echo "✅ vNext validation completed successfully"
else
VALIDATION_EXIT_CODE=$?
echo "⚠️ vNext validation found issues"
fi

# Restore diagram files
echo "📋 Restoring diagram files..."
SKIP_FILES=$(find core -name "*.diagram.json.skip" -type f 2>/dev/null || true)
if [ -n "$SKIP_FILES" ]; then
echo "$SKIP_FILES" | while read file; do
if [ -f "$file" ]; then
mv "$file" "${file%.skip}"
echo " Restored: ${file%.skip}"
fi
done
fi

# Exit with validation error code if validation failed
if [ $VALIDATION_EXIT_CODE -ne 0 ]; then
echo ""
echo "❌ vNext validation failed"
echo "Please check the validation errors above and fix them before proceeding"
echo "=========================================="
echo "Validation errors found in the following areas:"
echo "1. Schema files - Check if schema files are properly formatted"
echo "2. Task files - Check for missing required properties (tags, valid type values)"
echo ""
echo "Common issues to check:"
Comment on lines +131 to +140
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The comment claims to propagate the original validation exit code, but the script always exits with status 1.

The code always does exit 1 rather than using VALIDATION_EXIT_CODE. If you intend to preserve the vnext validate exit code, you could do:

if [ "$VALIDATION_EXIT_CODE" -ne 0 ]; then
  # ... messages ...
  exit "$VALIDATION_EXIT_CODE"
fi

If you instead want to normalize all failures to 1, please update the comment so it doesn’t imply the original validation code is propagated.

echo "- Schema files should not be validated as component instances"
echo "- Task files must have 'tags' property"
echo "- Task 'type' values must be valid (not '13' or '14')"
echo ""
echo "Note: Diagram files (.diagram.json) are excluded from validation"
echo "Please fix the validation errors above before proceeding"
exit 1
fi

Expand Down