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:
Aaron Powell
2026-02-25 16:23:49 +11:00
parent 6fc9e9375a
commit 83aed9e974
4 changed files with 11 additions and 54 deletions

View File

@@ -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);

View File

@@ -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,
};
},

View File

@@ -24,10 +24,6 @@ import Modal from '../components/Modal.astro';
<label for="filter-trigger">Trigger:</label>
<select id="filter-trigger" multiple aria-label="Filter by trigger"></select>
</div>
<div class="filter-group">
<label for="filter-tag">Tag:</label>
<select id="filter-tag" multiple aria-label="Filter by tag"></select>
</div>
<div class="filter-group">
<label for="sort-select">Sort:</label>
<select id="sort-select" aria-label="Sort by">

View File

@@ -18,7 +18,6 @@ interface Workflow extends SearchItem {
id: string;
path: string;
triggers: string[];
tags: string[];
lastUpdated?: string | null;
}
@@ -26,7 +25,6 @@ interface WorkflowsData {
items: Workflow[];
filters: {
triggers: string[];
tags: string[];
};
}
@@ -36,10 +34,8 @@ const resourceType = "workflow";
let allItems: Workflow[] = [];
let search = new FuzzySearch<Workflow>();
let triggerSelect: Choices;
let tagSelect: Choices;
let currentFilters = {
triggers: [] as string[],
tags: [] as string[],
};
let currentSort: SortOption = "title";
@@ -68,11 +64,6 @@ function applyFiltersAndRender(): void {
item.triggers.some((t) => currentFilters.triggers.includes(t))
);
}
if (currentFilters.tags.length > 0) {
results = results.filter((item) =>
item.tags.some((t) => currentFilters.tags.includes(t))
);
}
results = sortItems(results);
@@ -84,12 +75,6 @@ function applyFiltersAndRender(): void {
currentFilters.triggers.length > 1 ? "s" : ""
}`
);
if (currentFilters.tags.length > 0)
activeFilters.push(
`${currentFilters.tags.length} tag${
currentFilters.tags.length > 1 ? "s" : ""
}`
);
let countText = `${results.length} of ${allItems.length} workflows`;
if (activeFilters.length > 0) {
countText += ` (filtered by ${activeFilters.join(", ")})`;
@@ -125,12 +110,6 @@ function renderItems(items: Workflow[], query = ""): void {
`<span class="resource-tag tag-trigger">${escapeHtml(t)}</span>`
)
.join("")}
${item.tags
.map(
(t) =>
`<span class="resource-tag tag-tag">${escapeHtml(t)}</span>`
)
.join("")}
${getLastUpdatedHtml(item.lastUpdated)}
</div>
</div>
@@ -191,21 +170,6 @@ export async function initWorkflowsPage(): Promise<void> {
applyFiltersAndRender();
});
// Setup tag filter
tagSelect = createChoices("#filter-tag", {
placeholderValue: "All Tags",
});
tagSelect.setChoices(
data.filters.tags.map((t) => ({ value: t, label: t })),
"value",
"label",
true
);
document.getElementById("filter-tag")?.addEventListener("change", () => {
currentFilters.tags = getChoicesValues(tagSelect);
applyFiltersAndRender();
});
sortSelect?.addEventListener("change", () => {
currentSort = sortSelect.value as SortOption;
applyFiltersAndRender();
@@ -218,10 +182,9 @@ export async function initWorkflowsPage(): Promise<void> {
);
clearFiltersBtn?.addEventListener("click", () => {
currentFilters = { triggers: [], tags: [] };
currentFilters = { triggers: [] };
currentSort = "title";
triggerSelect.removeActiveItems();
tagSelect.removeActiveItems();
if (searchInput) searchInput.value = "";
if (sortSelect) sortSelect.value = "title";
applyFiltersAndRender();