mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-16 08:45:57 +08:00
chore: update issue support create label (#198)
This commit is contained in:
@@ -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);
|
||||
|
@@ -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,
|
||||
|
@@ -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>;
|
||||
|
||||
|
Reference in New Issue
Block a user