diff --git a/.github/workflows/update-icons.yml b/.github/workflows/update-icons.yml index e505a326e..362d84e21 100644 --- a/.github/workflows/update-icons.yml +++ b/.github/workflows/update-icons.yml @@ -13,11 +13,11 @@ 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" @@ -25,14 +25,28 @@ jobs: - 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 }}> diff --git a/packages/icon-kit/src/index.ts b/packages/icon-kit/src/index.ts index c316c0715..e8eb7e9c1 100644 --- a/packages/icon-kit/src/index.ts +++ b/packages/icon-kit/src/index.ts @@ -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); @@ -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";