Add support lucide icons
This commit is contained in:
@@ -46,6 +46,7 @@ For example: `ci/django.yml` and `ci/properties/django.properties.json`.
|
||||
* `name`: the name shown in onboarding. This property is unique within the repository.
|
||||
* `description`: the description shown in onboarding
|
||||
* `iconName`: the icon name in the relevant folder, for example, `django` should have an icon `icons/django.svg`. Only SVG is supported at this time. Another option is to use [octicon](https://primer.style/octicons/). The format to use an octicon is `octicon <<icon name>>`. Example: `octicon person`
|
||||
Another option is to use [lucide](https://lucide.dev/icons/). The format to use a lucide icon is `lucide <<icon name>>`. Example: `lucide bug`.
|
||||
* `creator`: creator of the template shown in onboarding. All the workflow templates from an author will have the same `creator` field.
|
||||
* `categories`: the categories that it will be shown under. Choose at least one category from the list [here](#categories). Further, choose the categories from the list of languages available [here](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) and the list of tech stacks available [here](https://github.com/github-starter-workflows/repo-analysis-partner/blob/main/tech_stacks.yml). When a user views the available templates, those templates that match the language and tech stacks will feature more prominently.
|
||||
|
||||
|
||||
@@ -189,7 +189,12 @@ async function checkWorkflow(
|
||||
};
|
||||
|
||||
if (x.iconType === "svg") {
|
||||
r.push(join("../../icons", `${x.iconName}.svg`));
|
||||
r.push(
|
||||
join(
|
||||
"../../icons",
|
||||
`${x.iconName && x.iconName.startsWith("lucide ") ? `lucide-${x.iconName.slice("lucide ".length).trim()}` : x.iconName}.svg`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return r;
|
||||
|
||||
@@ -91,10 +91,25 @@ async function checkWorkflow(workflowPath: string, propertiesPath: string, allow
|
||||
|
||||
if (properties.iconName) {
|
||||
if(! /^octicon\s+/.test(properties.iconName)) {
|
||||
try {
|
||||
await fs.access(`../../icons/${properties.iconName}.svg`)
|
||||
} catch (e) {
|
||||
let svgIconName: string | undefined = properties.iconName
|
||||
if (properties.iconName.startsWith("lucide ")) {
|
||||
const lucideName = properties.iconName.slice("lucide ".length).split(".")[0].trim()
|
||||
if(!lucideName) {
|
||||
workflowErrors.errors.push(`No icon named ${properties.iconName} found`)
|
||||
svgIconName = undefined
|
||||
} else {
|
||||
svgIconName = `lucide-${lucideName}`
|
||||
}
|
||||
}
|
||||
|
||||
if(!svgIconName) {
|
||||
workflowErrors.errors.push(`No icon named ${properties.iconName} found`)
|
||||
} else {
|
||||
try {
|
||||
await fs.access(`../../icons/${svgIconName}.svg`)
|
||||
} catch (e) {
|
||||
workflowErrors.errors.push(`No icon named ${properties.iconName} found`)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user