feat: add author name to skipped packages in Discord notifications
API Changes: - Track author name along with package name and reason - Extract author from pkg.author (string or object with name field) - Default to "unknown" if author info not available Workflow Changes: - Display author in format: "package-name (by author) - reason" Example Discord output: 📋 Skipped Packages tpmjs-threejs-tool (by john-doe) - invalid tpmjs field @scope/package-1 (by jane-smith) - missing tpmjs field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
63cd815bf4
commit
277c9f74cd
2 changed files with 25 additions and 5 deletions
2
.github/workflows/sync-keyword.yml
vendored
2
.github/workflows/sync-keyword.yml
vendored
|
|
@ -59,7 +59,7 @@ jobs:
|
|||
|
||||
# Store skipped packages for Discord
|
||||
if [ "$skipped" -gt 0 ]; then
|
||||
skippedList=$(echo "$response" | jq -r '.data.skippedPackages[]? | "\(.name) - \(.reason)"' 2>/dev/null | paste -sd "\n" - || echo "")
|
||||
skippedList=$(echo "$response" | jq -r '.data.skippedPackages[]? | "\(.name) (by \(.author)) - \(.reason)"' 2>/dev/null | paste -sd "\n" - || echo "")
|
||||
if [ -n "$skippedList" ]; then
|
||||
echo "$skippedList" > /tmp/skipped_packages.txt
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export async function POST(request: NextRequest) {
|
|||
let skipped = 0;
|
||||
let errors = 0;
|
||||
const errorMessages: string[] = [];
|
||||
const skippedPackages: Array<{ name: string; reason: string }> = [];
|
||||
const skippedPackages: Array<{ name: string; author: string; reason: string }> = [];
|
||||
|
||||
try {
|
||||
// Search for packages with 'tpmjs-tool' keyword
|
||||
|
|
@ -48,14 +48,30 @@ export async function POST(request: NextRequest) {
|
|||
// Skip if package not found
|
||||
if (!pkg) {
|
||||
skipped++;
|
||||
skippedPackages.push({ name: result.package.name, reason: 'package not found' });
|
||||
skippedPackages.push({
|
||||
name: result.package.name,
|
||||
author: 'unknown',
|
||||
reason: 'package not found',
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
// Extract author name
|
||||
const authorName =
|
||||
typeof pkg.author === 'string'
|
||||
? pkg.author
|
||||
: typeof pkg.author === 'object' && pkg.author?.name
|
||||
? pkg.author.name
|
||||
: 'unknown';
|
||||
|
||||
// Check if package has tpmjs field
|
||||
if (!pkg.tpmjs) {
|
||||
skipped++;
|
||||
skippedPackages.push({ name: pkg.name, reason: 'missing tpmjs field' });
|
||||
skippedPackages.push({
|
||||
name: pkg.name,
|
||||
author: authorName,
|
||||
reason: 'missing tpmjs field',
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +79,11 @@ export async function POST(request: NextRequest) {
|
|||
const validation = validateTpmjsField(pkg.tpmjs);
|
||||
if (!validation.valid || !validation.data) {
|
||||
skipped++;
|
||||
skippedPackages.push({ name: pkg.name, reason: 'invalid tpmjs field' });
|
||||
skippedPackages.push({
|
||||
name: pkg.name,
|
||||
author: authorName,
|
||||
reason: 'invalid tpmjs field',
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue