chore: update issue support create label (#198)

This commit is contained in:
xrkffgg
2024-11-01 17:57:55 +08:00
committed by GitHub
parent 26a4993608
commit 77e16f7f08
3 changed files with 15 additions and 7 deletions

View File

@@ -74,8 +74,8 @@ export async function doCreateIssue(
export async function doCreateLabel() {
const name = core.getInput('label-name');
const color = core.getInput('label-color') || 'ededed';
const description = core.getInput('label-desc') || '';
const color = core.getInput('label-color');
const description = core.getInput('label-desc');
if (name) {
await ICE.createLabel(name, color, description);

View File

@@ -130,8 +130,8 @@ export class IssueCoreEngine implements IIssueCoreEngine {
public async createLabel(
labelName: string,
labelColor: string,
labelDescription: string | undefined,
labelColor: string = 'ededed',
labelDescription: string = '',
) {
const { owner, repo, octokit } = this;
await octokit.issues.createLabel({
@@ -318,11 +318,19 @@ export class IssueCoreEngine implements IIssueCoreEngine {
state: baseState,
} = issue;
const baseLabelsName = baseLabels.map(({ name }: any) => name);
const baseAssignessName = baseAssigness?.map(({ login }: any) => login);
const baseLabelsName = baseLabels.map(({ name }) => name);
const baseAssignessName = baseAssigness?.map(({ login }) => login);
const newBody = body ? (mode === 'append' ? `${baseBody}\n${body}` : body) : baseBody;
if (labels && labels.length) {
for (const label of labels) {
if (baseLabelsName && baseLabelsName.length && baseLabelsName.indexOf(label) < 0) {
await this.createLabel(label);
}
}
}
await octokit.issues.update({
owner,
repo,

View File

@@ -83,7 +83,7 @@ export interface IIssueCoreEngine {
createIssueEmoji: (emoji: TEmoji[]) => Promise<void>;
createLabel: (
labelName: string,
labelColor: string,
labelColor: string | undefined,
labelDescription: string | undefined,
) => Promise<void>;