mirror of
https://github.com/github/awesome-copilot.git
synced 2026-03-12 12:15:12 +00:00
Extract workflow triggers from 'on' frontmatter field, drop tags
Update parseWorkflowMetadata to extract triggers from the 'on' property keys (e.g. schedule, issue_comment) instead of a separate 'triggers' field. Remove tags support from workflows since workflows don't use tags. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -204,7 +204,6 @@ function generateWorkflowsData(gitDates) {
|
||||
items: workflows,
|
||||
filters: {
|
||||
triggers: [],
|
||||
tags: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -214,7 +213,6 @@ function generateWorkflowsData(gitDates) {
|
||||
});
|
||||
|
||||
const allTriggers = new Set();
|
||||
const allTags = new Set();
|
||||
|
||||
for (const file of workflowFiles) {
|
||||
const filePath = path.join(WORKFLOWS_DIR, file);
|
||||
@@ -226,7 +224,6 @@ function generateWorkflowsData(gitDates) {
|
||||
.replace(/\\/g, "/");
|
||||
|
||||
(metadata.triggers || []).forEach((t) => allTriggers.add(t));
|
||||
(metadata.tags || []).forEach((t) => allTags.add(t));
|
||||
|
||||
const id = path.basename(file, ".md");
|
||||
workflows.push({
|
||||
@@ -234,7 +231,6 @@ function generateWorkflowsData(gitDates) {
|
||||
title: metadata.name,
|
||||
description: metadata.description,
|
||||
triggers: metadata.triggers || [],
|
||||
tags: metadata.tags || [],
|
||||
path: relativePath,
|
||||
lastUpdated: gitDates.get(relativePath) || null,
|
||||
});
|
||||
@@ -248,7 +244,6 @@ function generateWorkflowsData(gitDates) {
|
||||
items: sortedWorkflows,
|
||||
filters: {
|
||||
triggers: Array.from(allTriggers).sort(),
|
||||
tags: Array.from(allTags).sort(),
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -682,9 +677,7 @@ function generateSearchIndex(
|
||||
lastUpdated: workflow.lastUpdated,
|
||||
searchText: `${workflow.title} ${
|
||||
workflow.description
|
||||
} ${workflow.triggers.join(" ")} ${workflow.tags.join(
|
||||
" "
|
||||
)}`.toLowerCase(),
|
||||
} ${workflow.triggers.join(" ")}`.toLowerCase(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -843,7 +836,7 @@ async function main() {
|
||||
const workflowsData = generateWorkflowsData(gitDates);
|
||||
const workflows = workflowsData.items;
|
||||
console.log(
|
||||
`✓ Generated ${workflows.length} workflows (${workflowsData.filters.triggers.length} triggers, ${workflowsData.filters.tags.length} tags)`
|
||||
`✓ Generated ${workflows.length} workflows (${workflowsData.filters.triggers.length} triggers)`
|
||||
);
|
||||
|
||||
const instructionsData = generateInstructionsData(gitDates);
|
||||
|
||||
@@ -275,14 +275,19 @@ function parseWorkflowMetadata(filePath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Extract triggers from frontmatter if present
|
||||
const triggers = frontmatter.triggers || [];
|
||||
// Extract triggers from the 'on' field (top-level keys)
|
||||
const onField = frontmatter.on;
|
||||
const triggers = [];
|
||||
if (onField && typeof onField === "object") {
|
||||
triggers.push(...Object.keys(onField));
|
||||
} else if (typeof onField === "string") {
|
||||
triggers.push(onField);
|
||||
}
|
||||
|
||||
return {
|
||||
name: frontmatter.name,
|
||||
description: frontmatter.description,
|
||||
triggers,
|
||||
tags: frontmatter.tags || [],
|
||||
path: filePath,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user