feat: add `$exclude-empty (#112)

* feat: add `$exclude-empty

* docs: up

* chore: format
This commit is contained in:
xrkffgg
2022-08-26 16:33:14 +08:00
committed by GitHub
parent 6672cf5641
commit 982af7d1b7
8 changed files with 47 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ import utc from 'dayjs/plugin/utc';
import * as core from '../core';
import type { IIssueCoreEngine, IListIssuesParams, TCommentInfo, TIssueList } from '../issue';
import { EConst } from '../shared';
import type { TCloseReason, TEmoji, TIssueState, TOutList } from '../types';
import { checkDuplicate, matchKeyword, replaceStr2Arr } from '../util';
import {
@@ -67,8 +68,12 @@ export async function doQueryIssues(
*/
if (bodyCheck && titleCheck && issue.pull_request === undefined) {
if (excludeLabelsArr.length) {
for (let i = 0; i < issue.labels.length; i += 1) {
if (excludeLabelsArr.includes(issue.labels[i].name)) return;
if (issue.labels.length) {
for (let i = 0; i < issue.labels.length; i += 1) {
if (excludeLabelsArr.includes(issue.labels[i].name)) return;
}
} else {
if (excludeLabelsArr.includes(EConst.ExcludeEmpty)) return;
}
}

View File

@@ -15,3 +15,7 @@ export const ELockReasons = {
resolved: 'resolved',
spam: 'spam',
};
export const EConst = {
ExcludeEmpty: '$exclude-empty',
};