feat: add skip reasons to Discord notifications

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 <noreply@anthropic.com>
This commit is contained in:
Ajax Davis 2025-12-03 08:59:33 +10:00
parent 0b30c62ff9
commit 63cd815bf4
2 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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;
}