ci(suggest-tags): Fix failing job

This commit is contained in:
Eric Fennis
2025-07-04 17:27:07 +02:00
parent 599c517188
commit 6f384680b4
2 changed files with 30 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ import { zodTextFormat } from "openai/helpers/zod";
import path from "node:path";
import fs from "node:fs/promises";
import z from "zod";
import { IconMetadata } from '../tools/build-icons/types';
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
const pullRequestNumber = Number(process.env.PULL_REQUEST_NUMBER);
@@ -68,7 +69,7 @@ const suggestionsByFile = changedFiles.map(async ({ filename, raw_url }) => {
},
});
const { tags: suggestedTags } = JSON.parse(response.output_text);
const { tags: suggestedTags }: IconMetadata = JSON.parse(response.output_text);
console.log(`Suggesting tags for ${iconName}:`, suggestedTags);
@@ -114,6 +115,7 @@ Here are the suggestions:
path: filename,
line: startLine,
body: message,
side: "RIGHT"
}
})
@@ -124,13 +126,28 @@ if (comments.length === 0) {
process.exit(0);
}
await octokit.pulls.createReview({
owner,
repo,
pull_number: pullRequestNumber,
body: `### 🤖 ChatGPT Tags suggestions ✨
I've asked ChatGPT for some suggestions for tags.`,
event: "COMMENT",
comments,
commit_id: commitSha,
});
try {
console.log({
owner,
repo,
pull_number: pullRequestNumber,
body: `### 🤖 ChatGPT Tags suggestions
I've asked ChatGPT for some suggestions for tags.`,
event: "COMMENT",
comments,
commit_id: commitSha,
})
await octokit.pulls.createReview({
owner,
repo,
pull_number: pullRequestNumber,
body: `### 🤖 ChatGPT Tags suggestions ✨
I've asked ChatGPT for some suggestions for tags.`,
event: "COMMENT",
comments,
commit_id: commitSha,
});
} catch (error) {
console.error('Error creating review:', error);
process.exit(0);
}

View File

@@ -30,9 +30,9 @@ export type IconDeprecationReason = 'icon.brand' | '';
export type IconMetadataBase = {
toBeRemovedInVersion?: string;
categories?: string[];
categories: string[];
aliases?: (string | AliasDeprecation)[];
tags?: string[];
tags: string[];
deprecationReason?: IconDeprecationReason;
deprecated?: boolean;
};