Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions .github/workflows/update-icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,40 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v6
- uses: actions/setup-node@v4
with:
node-version: "24"
cache: "pnpm"

- name: Install dependencies
run: pnpm i --frozen-lockfile --prefer-offline

- name: Install puppeteer
run: npx @puppeteer/browsers install chrome
- name: Install puppeteer chromium
run: node node_modules/puppeteer/install.js

- name: Pin puppeteer chromium path
run: |
CHROMIUM="$(node -e 'console.log(require("puppeteer").executablePath())')"
echo "Resolved Chromium: $CHROMIUM"
if [ ! -x "$CHROMIUM" ]; then
echo "::error::Chromium not found at $CHROMIUM after puppeteer install"
exit 1
fi
echo "PUPPETEER_EXECUTABLE_PATH=$CHROMIUM" >> "$GITHUB_ENV"

- name: Patch svgo-autocrop for CI
run: |
sed -i 's/Puppeteer\.launch()/Puppeteer.launch({ args: ["--no-sandbox", "--disable-setuid-sandbox"] })/' node_modules/svgo-autocrop/lib/Browser.js

- name: Update icons
run: pnpm --filter @shopware-ag/meteor-icon-kit run start

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update icons
committer: Dennis Mader <${{ secrets.ICON_KIT__COMMITTER }}>
Expand Down
18 changes: 16 additions & 2 deletions packages/icon-kit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ client
spinner.text = `Optimized ${0} out of ${iconMap.size} icons`;

const styling = [] as { name: string; width: string; height: string }[];
const failedIcons: { iconName: string; error: Error }[] = [];

await PromisePool.for(Array.from(iconMap.keys()))
.withConcurrency(25)
.onTaskFinished((iconName, pool) => {
spinner.text = `Optimized ${pool.processedCount()} out of ${iconMap.size} icons`;
})
.handleError((error) => {
console.log(error);
.handleError((error, iconName) => {
logger.info(`Failed to process icon: "${iconName}"`, { error });
failedIcons.push({ iconName, error });
})
.process(async (iconName: string) => {
const icon = iconMap.get(iconName);
Expand Down Expand Up @@ -143,6 +145,18 @@ client
});
});

if (failedIcons.length > 0) {
spinner.warn(
`Completed with ${failedIcons.length} failed icon(s) out of ${iconMap.size}:`
);
failedIcons.forEach(({ iconName, error }) => {
console.error(` ✗ ${iconName}: ${error.message}`);
});
throw new Error(
`Sync failed: ${failedIcons.length} icon(s) could not be processed`
);
}

spinner.text = "Finished writing icons to filesystem";
spinner.text = "Creating stylesheet";

Expand Down
Loading