mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-17 00:27:41 +01:00
ci(suggest-tags): Fix failing job
This commit is contained in:
@@ -6,6 +6,7 @@ import { zodTextFormat } from "openai/helpers/zod";
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
import { IconMetadata } from '../tools/build-icons/types';
|
||||||
|
|
||||||
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
|
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
|
||||||
const pullRequestNumber = Number(process.env.PULL_REQUEST_NUMBER);
|
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);
|
console.log(`Suggesting tags for ${iconName}:`, suggestedTags);
|
||||||
|
|
||||||
@@ -114,6 +115,7 @@ Here are the suggestions:
|
|||||||
path: filename,
|
path: filename,
|
||||||
line: startLine,
|
line: startLine,
|
||||||
body: message,
|
body: message,
|
||||||
|
side: "RIGHT"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -124,6 +126,17 @@ if (comments.length === 0) {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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({
|
await octokit.pulls.createReview({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
@@ -134,3 +147,7 @@ I've asked ChatGPT for some suggestions for tags.`,
|
|||||||
comments,
|
comments,
|
||||||
commit_id: commitSha,
|
commit_id: commitSha,
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error creating review:', error);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ export type IconDeprecationReason = 'icon.brand' | '';
|
|||||||
|
|
||||||
export type IconMetadataBase = {
|
export type IconMetadataBase = {
|
||||||
toBeRemovedInVersion?: string;
|
toBeRemovedInVersion?: string;
|
||||||
categories?: string[];
|
categories: string[];
|
||||||
aliases?: (string | AliasDeprecation)[];
|
aliases?: (string | AliasDeprecation)[];
|
||||||
tags?: string[];
|
tags: string[];
|
||||||
deprecationReason?: IconDeprecationReason;
|
deprecationReason?: IconDeprecationReason;
|
||||||
deprecated?: boolean;
|
deprecated?: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user