From 63cd815bf4748f77feea8c0952f2651cc76f0a9a Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Wed, 3 Dec 2025 08:59:33 +1000 Subject: [PATCH] feat: add skip reasons to Discord notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit API Changes: - Track skip reason along with package name - Changed skippedPackages from string[] to Array<{name, reason}> - Reasons: "package not found", "missing tpmjs field", "invalid tpmjs field" Workflow Changes: - Format skipped packages as "package-name - reason" - Display one package per line in Discord notification Example Discord output: 📋 Skipped Packages @scope/package-1 - missing tpmjs field package-2 - invalid tpmjs field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/sync-keyword.yml | 2 +- apps/web/src/app/api/sync/keyword/route.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync-keyword.yml b/.github/workflows/sync-keyword.yml index 6e41602..bd33f34 100644 --- a/.github/workflows/sync-keyword.yml +++ b/.github/workflows/sync-keyword.yml @@ -59,7 +59,7 @@ jobs: # Store skipped packages for Discord if [ "$skipped" -gt 0 ]; then - skippedList=$(echo "$response" | jq -r '.data.skippedPackages[]?' 2>/dev/null | paste -sd ", " - || echo "") + skippedList=$(echo "$response" | jq -r '.data.skippedPackages[]? | "\(.name) - \(.reason)"' 2>/dev/null | paste -sd "\n" - || echo "") if [ -n "$skippedList" ]; then echo "$skippedList" > /tmp/skipped_packages.txt fi diff --git a/apps/web/src/app/api/sync/keyword/route.ts b/apps/web/src/app/api/sync/keyword/route.ts index e3fd8f2..f338386 100644 --- a/apps/web/src/app/api/sync/keyword/route.ts +++ b/apps/web/src/app/api/sync/keyword/route.ts @@ -30,7 +30,7 @@ export async function POST(request: NextRequest) { let skipped = 0; let errors = 0; const errorMessages: string[] = []; - const skippedPackages: string[] = []; + const skippedPackages: Array<{ name: string; reason: string }> = []; try { // Search for packages with 'tpmjs-tool' keyword @@ -48,14 +48,14 @@ export async function POST(request: NextRequest) { // Skip if package not found if (!pkg) { skipped++; - skippedPackages.push(result.package.name); + skippedPackages.push({ name: result.package.name, reason: 'package not found' }); continue; } // Check if package has tpmjs field if (!pkg.tpmjs) { skipped++; - skippedPackages.push(pkg.name); + skippedPackages.push({ name: pkg.name, reason: 'missing tpmjs field' }); continue; } @@ -63,7 +63,7 @@ export async function POST(request: NextRequest) { const validation = validateTpmjsField(pkg.tpmjs); if (!validation.valid || !validation.data) { skipped++; - skippedPackages.push(pkg.name); + skippedPackages.push({ name: pkg.name, reason: 'invalid tpmjs field' }); continue; }