From fb0886b7245245876a76824bfe212c5cc68ee9fa Mon Sep 17 00:00:00 2001 From: Zach Shilton <4624598+zchsh@users.noreply.github.com> Date: Sat, 20 Mar 2021 21:32:13 -0400 Subject: [PATCH] website: Implement basic validation for plugin docs config --- .github/workflows/check-plugin-docs.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/check-plugin-docs.js b/.github/workflows/check-plugin-docs.js index ef4150fec..16a9495a3 100644 --- a/.github/workflows/check-plugin-docs.js +++ b/.github/workflows/check-plugin-docs.js @@ -20,6 +20,20 @@ async function checkPluginDocs() { console.log(`\n${COLOR_BLUE}${repo}${COLOR_RESET} | ${title}`); console.log(`Fetching docs from release "${version}" …`); try { + const undefinedProps = ["title", "repo", "version", "path"].filter( + (key) => typeof pluginEntry[key] == "undefined" + ); + if (undefinedProps.length > 0) { + throw new Error( + `Failed to validate plugin docs. Undefined configuration properties ${JSON.stringify( + undefinedProps + )} found for "${ + title || pluginEntry.path || repo + }". In "website/data/docs-remote-plugins.json", please ensure the missing properties ${JSON.stringify( + undefinedProps + )} are defined. Additional information on this configuration can be found in "website/README.md".` + ); + } const docsMdxFiles = await fetchPluginDocs({ repo, tag: version }); const mdxFilesByComponent = docsMdxFiles.reduce((acc, mdxFile) => { const componentType = mdxFile.filePath.split("/")[1];