fix(ci): refresh lockfile in PR jobs

This commit is contained in:
dotta 2026-03-23 19:23:10 -05:00
parent 2cc2d4420d
commit 85d2c54d53
2 changed files with 47 additions and 5 deletions

View file

@ -56,6 +56,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm - name: Setup pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
@ -68,6 +70,14 @@ jobs:
node-version: 24 node-version: 24
cache: pnpm cache: pnpm
- name: Refresh lockfile when manifests change
run: |
changed="$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")"
manifest_pattern='(^|/)package\.json$|^pnpm-workspace\.yaml$|^\.npmrc$|^pnpmfile\.(cjs|js|mjs)$'
if printf '%s\n' "$changed" | grep -Eq "$manifest_pattern"; then
pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile
fi
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
@ -94,6 +104,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm - name: Setup pnpm
uses: pnpm/action-setup@v4 uses: pnpm/action-setup@v4
@ -106,6 +118,14 @@ jobs:
node-version: 24 node-version: 24
cache: pnpm cache: pnpm
- name: Refresh lockfile when manifests change
run: |
changed="$(git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}")"
manifest_pattern='(^|/)package\.json$|^pnpm-workspace\.yaml$|^\.npmrc$|^pnpmfile\.(cjs|js|mjs)$'
if printf '%s\n' "$changed" | grep -Eq "$manifest_pattern"; then
pnpm install --lockfile-only --ignore-scripts --no-frozen-lockfile
fi
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile

View file

@ -112,11 +112,7 @@ function buildAgentIconMask(iconName: string | null): string | null {
if (cached) return cached; if (cached) return cached;
const Icon = getAgentIcon(iconName); const Icon = getAgentIcon(iconName);
const iconNode = ( const iconNode = resolveLucideIconNode(Icon);
Icon as unknown as {
iconNode?: Array<[string, Record<string, string>]>;
}
).iconNode;
if (!Array.isArray(iconNode) || iconNode.length === 0) return null; if (!Array.isArray(iconNode) || iconNode.length === 0) return null;
const body = iconNode.map(([tag, attrs]) => { const body = iconNode.map(([tag, attrs]) => {
@ -136,6 +132,32 @@ function buildAgentIconMask(iconName: string | null): string | null {
return url; return url;
} }
function resolveLucideIconNode(
icon: unknown,
): Array<[string, Record<string, string>]> | null {
const staticIconNode = (
icon as {
iconNode?: Array<[string, Record<string, string>]>;
}
).iconNode;
if (Array.isArray(staticIconNode) && staticIconNode.length > 0) {
return staticIconNode;
}
const render = (
icon as {
render?: (props: Record<string, unknown>, ref: unknown) => {
props?: { iconNode?: Array<[string, Record<string, string>]> };
} | null;
}
).render;
const rendered = typeof render === "function" ? render({}, null) : null;
const renderedIconNode = rendered?.props?.iconNode;
return Array.isArray(renderedIconNode) && renderedIconNode.length > 0
? renderedIconNode
: null;
}
function escapeAttribute(value: string): string { function escapeAttribute(value: string): string {
return value return value
.replaceAll("&", "&amp;") .replaceAll("&", "&amp;")