From 5cb5d69eb80ba7def672ad30bbe06078015bd981 Mon Sep 17 00:00:00 2001 From: voidptr <1711810+taraxvoid@users.noreply.github.com> Date: Tue, 30 Jun 2026 10:52:10 -0500 Subject: [PATCH] fix: strip Decap CMS wrapper format in format-yaml.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Decap CMS saves via git-gateway it writes files wrapped in CMS metadata (partial/path/meta/raw/data/collection/…) instead of bare page content. The existing CI normalize step reformatted these files but left the structure intact, so astro check kept failing on `title: Required`. Detect the wrapper by checking for `data` + `collection` at root, then extract `parsed.data` before normalizing. The CI workflow is unchanged; it already triggers and pushes a fixup commit on every CMS PR. Co-Authored-By: Claude Sonnet 4.6 --- scripts/format-yaml.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/format-yaml.js b/scripts/format-yaml.js index c462f66..53401fe 100644 --- a/scripts/format-yaml.js +++ b/scripts/format-yaml.js @@ -75,8 +75,12 @@ for (const file of files) { (_, prefix, value) => `${prefix}'${value.replace(/'/g, "''")}'`, ) const parsed = parse(preprocessed) - normalizeLinks(parsed) - canonical = stringify(parsed, { lineWidth: 0 }) + // Decap CMS wraps content under 'data:' with CMS metadata around it. + // If this shape is detected, extract just the page content. + const content = + parsed?.data && parsed?.collection != null ? parsed.data : parsed + normalizeLinks(content) + canonical = stringify(content, { lineWidth: 0 }) } catch (err) { errors.push(` ${file}: ${err.message}`) continue