Update check-glama.yml

This commit is contained in:
Frank Fiegel
2026-03-12 04:36:32 -06:00
committed by GitHub
parent eae0a621db
commit cec374e6f0

View File

@@ -96,19 +96,21 @@ jobs:
'\u{1F427}', // 🐧 Linux '\u{1F427}', // 🐧 Linux
]; ];
// Only check added lines (starting with +) for glama link // All added lines with GitHub links (includes stale diff noise)
const hasGlama = files.some(file =>
file.patch && file.patch.split('\n')
.filter(line => line.startsWith('+'))
.some(line => line.includes('glama.ai/mcp/servers'))
);
// Check added lines for emoji usage
const addedLines = files const addedLines = files
.filter(f => f.patch) .filter(f => f.patch)
.flatMap(f => f.patch.split('\n').filter(line => line.startsWith('+'))) .flatMap(f => f.patch.split('\n').filter(line => line.startsWith('+')))
.filter(line => line.includes('](https://github.com/')); .filter(line => line.includes('](https://github.com/'));
// Filter to only genuinely new entries (not already in the base README)
const newAddedLines = addedLines.filter(line => {
const ghMatch = line.match(/\(https:\/\/github\.com\/[^)]+\)/i);
return !ghMatch || !existingUrls.has(ghMatch[0].toLowerCase());
});
// Only check new entries for glama link
const hasGlama = newAddedLines.some(line => line.includes('glama.ai/mcp/servers'));
let hasValidEmoji = false; let hasValidEmoji = false;
let hasInvalidEmoji = false; let hasInvalidEmoji = false;
const invalidLines = []; const invalidLines = [];
@@ -142,16 +144,14 @@ jobs:
} }
} }
for (const line of addedLines) { for (const line of newAddedLines) {
const usedPermitted = permittedEmojis.filter(e => line.includes(e)); const usedPermitted = permittedEmojis.filter(e => line.includes(e));
if (usedPermitted.length > 0) { if (usedPermitted.length > 0) {
hasValidEmoji = true; hasValidEmoji = true;
} else { } else {
// Line with a GitHub link but no permitted emoji
invalidLines.push(line.replace(/^\+/, '').trim()); invalidLines.push(line.replace(/^\+/, '').trim());
} }
// Check for emojis that aren't in the permitted list
const emojiRegex = /\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu; const emojiRegex = /\p{Emoji_Presentation}|\p{Emoji}\uFE0F/gu;
const allEmojis = line.match(emojiRegex) || []; const allEmojis = line.match(emojiRegex) || [];
const unknownEmojis = allEmojis.filter(e => !permittedEmojis.some(p => p.includes(e) || e.includes(p))); const unknownEmojis = allEmojis.filter(e => !permittedEmojis.some(p => p.includes(e) || e.includes(p)));
@@ -159,21 +159,18 @@ jobs:
hasInvalidEmoji = true; hasInvalidEmoji = true;
} }
// Check that the link text uses full owner/repo format
// Pattern: [link-text](https://github.com/owner/repo)
const entryRegex = /\[([^\]]+)\]\(https:\/\/github\.com\/([^/]+)\/([^/)]+)\)/; const entryRegex = /\[([^\]]+)\]\(https:\/\/github\.com\/([^/]+)\/([^/)]+)\)/;
const match = line.match(entryRegex); const match = line.match(entryRegex);
if (match) { if (match) {
const linkText = match[1]; const linkText = match[1];
const expectedName = `${match[2]}/${match[3]}`; const expectedName = `${match[2]}/${match[3]}`;
// Link text should contain owner/repo (case-insensitive)
if (!linkText.toLowerCase().includes('/')) { if (!linkText.toLowerCase().includes('/')) {
badNameLines.push({ linkText, expectedName }); badNameLines.push({ linkText, expectedName });
} }
} }
} }
const emojiOk = addedLines.length === 0 || (hasValidEmoji && !hasInvalidEmoji && invalidLines.length === 0); const emojiOk = newAddedLines.length === 0 || (hasValidEmoji && !hasInvalidEmoji && invalidLines.length === 0);
const nameOk = badNameLines.length === 0; const nameOk = badNameLines.length === 0;
const noDuplicates = duplicateUrls.length === 0; const noDuplicates = duplicateUrls.length === 0;
const allGithub = nonGithubUrls.length === 0; const allGithub = nonGithubUrls.length === 0;
@@ -265,7 +262,11 @@ jobs:
const glamaLines = files const glamaLines = files
.filter(f => f.patch) .filter(f => f.patch)
.flatMap(f => f.patch.split('\n').filter(l => l.startsWith('+'))) .flatMap(f => f.patch.split('\n').filter(l => l.startsWith('+')))
.filter(l => l.includes('glama.ai/mcp/servers')); .filter(l => l.includes('glama.ai/mcp/servers'))
.filter(l => {
const ghMatch = l.match(/\(https:\/\/github\.com\/[^)]+\)/i);
return !ghMatch || !existingUrls.has(ghMatch[0].toLowerCase());
});
let glamaServerPath = ''; let glamaServerPath = '';
for (const line of glamaLines) { for (const line of glamaLines) {
@@ -296,7 +297,7 @@ jobs:
} }
// Emoji comment // Emoji comment
if (!emojiOk && addedLines.length > 0) { if (!emojiOk && newAddedLines.length > 0) {
const marker = '<!-- emoji-check -->'; const marker = '<!-- emoji-check -->';
if (!comments.some(c => c.body.includes(marker))) { if (!comments.some(c => c.body.includes(marker))) {
const emojiList = [ const emojiList = [