提交 21080d6c 编写于 作者: T Tomas Vik

fix: validate CI command didn't show validation result

This was caused by converting the validation response to boolean instead
of returning all details.
上级 01eba31c
......@@ -484,19 +484,25 @@ export async function createSnippet(repositoryRoot: string, data: { id: number }
}
}
export async function validateCIConfig(repositoryRoot: string, content: string): Promise<boolean> {
let validCIConfig = null;
interface ValidationResponse {
status?: string;
errors: string[];
error: string;
}
export async function validateCIConfig(
repositoryRoot: string,
content: string,
): Promise<ValidationResponse | undefined> {
try {
const { response } = await fetch(repositoryRoot, '/ci/lint', 'POST', {
content,
});
validCIConfig = response;
return response;
} catch (e) {
handleError(new UserFriendlyError('Failed to validate CI configuration.', e));
return undefined;
}
return Boolean(validCIConfig);
}
export async function renderMarkdown(markdown: string, repositoryRoot: string) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册