Normalize SVG icon names in workflow checks
This commit is contained in:
@@ -30,6 +30,19 @@ interface WorkflowsCheckResult {
|
|||||||
incompatibleWorkflows: WorkflowDesc[];
|
incompatibleWorkflows: WorkflowDesc[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeSvgIconName(iconName?: string): string | undefined {
|
||||||
|
if (!iconName || iconName.startsWith("octicon")) {
|
||||||
|
return iconName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconName.startsWith("lucide ")) {
|
||||||
|
const lucideName = iconName.slice("lucide ".length).split(".")[0].trim();
|
||||||
|
return lucideName ? `lucide-${lucideName}` : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return iconName;
|
||||||
|
}
|
||||||
|
|
||||||
async function checkWorkflows(
|
async function checkWorkflows(
|
||||||
folders: string[],
|
folders: string[],
|
||||||
enabledActions: string[],
|
enabledActions: string[],
|
||||||
@@ -56,6 +69,7 @@ async function checkWorkflows(
|
|||||||
`${workflowId}.properties.json`
|
`${workflowId}.properties.json`
|
||||||
));
|
));
|
||||||
const iconName: string | undefined = workflowProperties["iconName"];
|
const iconName: string | undefined = workflowProperties["iconName"];
|
||||||
|
const normalizedSvgIconName = normalizeSvgIconName(iconName);
|
||||||
|
|
||||||
const isPartnerWorkflow = workflowProperties.creator ? partnersSet.has(workflowProperties.creator.toLowerCase()) : false;
|
const isPartnerWorkflow = workflowProperties.creator ? partnersSet.has(workflowProperties.creator.toLowerCase()) : false;
|
||||||
|
|
||||||
@@ -67,7 +81,7 @@ async function checkWorkflows(
|
|||||||
const workflowDesc: WorkflowDesc = {
|
const workflowDesc: WorkflowDesc = {
|
||||||
folder,
|
folder,
|
||||||
id: workflowId,
|
id: workflowId,
|
||||||
iconName,
|
iconName: normalizedSvgIconName,
|
||||||
iconType:
|
iconType:
|
||||||
iconName && iconName.startsWith("octicon") ? "octicon" : "svg",
|
iconName && iconName.startsWith("octicon") ? "octicon" : "svg",
|
||||||
};
|
};
|
||||||
@@ -192,7 +206,7 @@ async function checkWorkflow(
|
|||||||
r.push(
|
r.push(
|
||||||
join(
|
join(
|
||||||
"../../icons",
|
"../../icons",
|
||||||
`${x.iconName && x.iconName.startsWith("lucide ") ? `lucide-${x.iconName.slice("lucide ".length).trim()}` : x.iconName}.svg`
|
`${x.iconName}.svg`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user