mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-27 05:59:12 +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() {
|
export async function doCreateLabel() {
|
||||||
const name = core.getInput('label-name');
|
const name = core.getInput('label-name');
|
||||||
const color = core.getInput('label-color') || 'ededed';
|
const color = core.getInput('label-color');
|
||||||
const description = core.getInput('label-desc') || '';
|
const description = core.getInput('label-desc');
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
await ICE.createLabel(name, color, description);
|
await ICE.createLabel(name, color, description);
|
||||||
|
@@ -130,8 +130,8 @@ export class IssueCoreEngine implements IIssueCoreEngine {
|
|||||||
|
|
||||||
public async createLabel(
|
public async createLabel(
|
||||||
labelName: string,
|
labelName: string,
|
||||||
labelColor: string,
|
labelColor: string = 'ededed',
|
||||||
labelDescription: string | undefined,
|
labelDescription: string = '',
|
||||||
) {
|
) {
|
||||||
const { owner, repo, octokit } = this;
|
const { owner, repo, octokit } = this;
|
||||||
await octokit.issues.createLabel({
|
await octokit.issues.createLabel({
|
||||||
@@ -318,11 +318,19 @@ export class IssueCoreEngine implements IIssueCoreEngine {
|
|||||||
state: baseState,
|
state: baseState,
|
||||||
} = issue;
|
} = issue;
|
||||||
|
|
||||||
const baseLabelsName = baseLabels.map(({ name }: any) => name);
|
const baseLabelsName = baseLabels.map(({ name }) => name);
|
||||||
const baseAssignessName = baseAssigness?.map(({ login }: any) => login);
|
const baseAssignessName = baseAssigness?.map(({ login }) => login);
|
||||||
|
|
||||||
const newBody = body ? (mode === 'append' ? `${baseBody}\n${body}` : body) : baseBody;
|
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({
|
await octokit.issues.update({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
|
@@ -83,7 +83,7 @@ export interface IIssueCoreEngine {
|
|||||||
createIssueEmoji: (emoji: TEmoji[]) => Promise<void>;
|
createIssueEmoji: (emoji: TEmoji[]) => Promise<void>;
|
||||||
createLabel: (
|
createLabel: (
|
||||||
labelName: string,
|
labelName: string,
|
||||||
labelColor: string,
|
labelColor: string | undefined,
|
||||||
labelDescription: string | undefined,
|
labelDescription: string | undefined,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user