File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -141,27 +141,30 @@ export async function updateMetadata(
141141 is_imported_content : safeAnalysis . is_imported_content || 'false'
142142 }
143143
144+ // Validate metadata in all cases
145+ const validationResult = await validateMetadata ( newMetadata , filepath , options )
146+
144147 // Check validation mode
145148 if ( options . validateOnly || options . prMode ) {
146149 return {
147- isValid : true ,
148- errors : [ ] ,
150+ isValid : validationResult . isValid ,
151+ errors : validationResult . errors ,
149152 suggestions : {
150153 categories : safeAnalysis . categories ,
151154 content_type : safeAnalysis . content_type
152155 }
153156 }
154157 }
155158
156- // Only write if not in dry run mode
157- if ( ! options . dryRun ) {
159+ // Only write if not in dry run mode and validation passed
160+ if ( ! options . dryRun && validationResult . isValid ) {
158161 const updatedContent = matter . stringify ( docContent , newMetadata )
159162 await fs . writeFile ( filepath , updatedContent , 'utf8' )
160163 }
161164
162165 return {
163- isValid : true ,
164- errors : [ ] ,
166+ isValid : validationResult . isValid ,
167+ errors : validationResult . errors ,
165168 suggestions : {
166169 categories : safeAnalysis . categories ,
167170 content_type : safeAnalysis . content_type
You can’t perform that action at this time.
0 commit comments