🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(ci): merge overlay allowBuilds on Windows CRLF files (#20311)
Innei42f361de3181
diff --git a/.github/scripts/mergeAllowBuilds.mjs b/.github/scripts/mergeAllowBuilds.mjsindex f89f4e96fde..09693771025 100644--- a/.github/scripts/mergeAllowBuilds.mjs+++ b/.github/scripts/mergeAllowBuilds.mjs@@ -7,7 +7,7 @@ const ALLOW_BUILDS_ENTRY = /^(\s+)('[^']+'|"[^"]+"|[\w@./-]+):\s*(true|false)\s*export const parseAllowBuilds = (text) => {const map = {};- const lines = text.split('\n');+ const lines = text.split(/\r?\n/);let inBlock = false;for (const line of lines) {if (!inBlock) {@@ -31,11 +31,15 @@ export const mergeAllowBuilds = ({ rootText, extraTexts }) => {.filter((key) => !(key in rootMap)).sort();if (missing.length === 0) return rootText;- if (!/^allowBuilds:\n/m.test(rootText)) {+ const header = /^allowBuilds:[ \t]*\r?\n/m.exec(rootText);+ if (!header) {throw new Error('overlay pnpm-workspace.yaml is missing an allowBuilds block');}- const insert = missing.map((key) => ` ${quoteKey(key)}: ${extras[key]}\n`).join('');- return rootText.replace(/^allowBuilds:\n/m, `allowBuilds:\n${insert}`);+ const nl = header[0].includes('\r') ? '\r\n' : '\n';+ const insert = missing.map((key) => ` ${quoteKey(key)}: ${extras[key]}${nl}`).join('');+ const start = header.index;+ const end = start + header[0].length;+ return `${rootText.slice(0, start)}allowBuilds:${nl}${insert}${rootText.slice(end)}`;};export const mergeAllowBuildsFiles = ({ rootFile, extraFiles }) => {diff --git a/.github/scripts/mergeAllowBuilds.test.mjs b/.github/scripts/mergeAllowBuilds.test.mjsindex cd0b6c12081..182c7b6917e 100644--- a/.github/scripts/mergeAllowBuilds.test.mjs+++ b/.github/scripts/mergeAllowBuilds.test.mjs@@ -71,3 +71,43 @@ test('mergeAllowBuilds throws when the overlay has no allowBuilds block', () =>/missing an allowBuilds block/,);});++test('mergeAllowBuilds inserts at the real header after a comment that mentions allowBuilds', () => {+ const overlayWithComment = `# allowBuilds:\n${overlayWorkspace}`;+ const merged = mergeAllowBuilds({+ extraTexts: [innerWorkspace],+ rootText: overlayWithComment,+ });++ assert.ok(merged.startsWith('# allowBuilds:\npackages:'));+ assert.match(+ merged,+ /\nallowBuilds:\n {2}'@google\/genai': true\n {2}'@mongodb-js\/zstd': false\n/,+ );+ assert.deepEqual(parseAllowBuilds(merged), {+ '@google/genai': true,+ '@mongodb-js/zstd': false,+ 'esbuild': false,+ 'node-liblzma': false,+ 'sharp': false,+ });+});++test('mergeAllowBuilds copies inner decisions into a CRLF overlay file', () => {+ const crlfOverlay = overlayWorkspace.replaceAll('\n', '\r\n');+ const merged = mergeAllowBuilds({+ extraTexts: [innerWorkspace],+ rootText: crlfOverlay,+ });++ assert.deepEqual(parseAllowBuilds(merged), {+ '@google/genai': true,+ '@mongodb-js/zstd': false,+ 'esbuild': false,+ 'node-liblzma': false,+ 'sharp': false,+ });+ assert.match(merged, /\r\n {2}'@mongodb-js\/zstd': false\r\n/);+ assert.match(merged, /\r\n {2}node-liblzma: false\r\n/);+ assert.match(merged, /\r\n {2}esbuild: false\r\n/);+});