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

@@ -7,6 +7,13 @@
🛠 refactor
-->
## v3.2.0
`2022.08.26`
- 🚀 feat: add `$exclude-empty` for `exclude-labels`. [#112](https://github.com/actions-cool/issues-helper/pull/112)
- When set to include `$exclude-empty`, no label issue can be excluded
## v3.1.0
`2022.08.09`

View File

@@ -770,6 +770,7 @@ jobs:
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
⏫ [Back to list](#List)
@@ -862,6 +863,7 @@ jobs:
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
⏫ [Back to list](#List)
@@ -942,6 +944,7 @@ Find the current repository, the creator is k , the title contains `this` , the
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
⏫ [Back to list](#List)
@@ -990,6 +993,7 @@ jobs:
- `issue-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
⏫ [Back to list](#List)

View File

@@ -773,6 +773,7 @@ jobs:
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
⏫ [返回列表](#列-表)
@@ -861,6 +862,7 @@ jobs:
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
⏫ [返回列表](#列-表)
@@ -941,6 +943,7 @@ jobs:
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
⏫ [返回列表](#列-表)
@@ -989,6 +992,7 @@ jobs:
- `issue-state`:默认为 `open`。可选值 `all` `closed`,非这 2 项时,均为 `open`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
⏫ [返回列表](#列-表)

16
dist/index.js vendored
View File

@@ -14605,6 +14605,7 @@ const dayjs_1 = __importDefault(__nccwpck_require__(7401));
const isSameOrBefore_1 = __importDefault(__nccwpck_require__(9517));
const utc_1 = __importDefault(__nccwpck_require__(4359));
const core = __importStar(__nccwpck_require__(9875));
const shared_1 = __nccwpck_require__(3826);
const util_1 = __nccwpck_require__(9604);
const base_1 = __nccwpck_require__(8824);
let ICE;
@@ -14649,8 +14650,14 @@ function doQueryIssues(state, creator, ignoreLabels) {
*/
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))
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(shared_1.EConst.ExcludeEmpty))
return;
}
}
@@ -15904,7 +15911,7 @@ main();
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ELockReasons = exports.EEmoji = void 0;
exports.EConst = exports.ELockReasons = exports.EEmoji = void 0;
exports.EEmoji = {
'+1': '+1',
'-1': '-1',
@@ -15921,6 +15928,9 @@ exports.ELockReasons = {
resolved: 'resolved',
spam: 'spam',
};
exports.EConst = {
ExcludeEmpty: '$exclude-empty',
};
/***/ }),

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',
};

View File

@@ -51,6 +51,7 @@ jobs:
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `check-issue`
@@ -139,6 +140,7 @@ jobs:
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `find-comments`
@@ -214,6 +216,7 @@ Find the current repository, the creator is k , the title contains `this` , the
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `lock-issues`
@@ -260,6 +263,7 @@ jobs:
- `issue-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `mark-assignees`

View File

@@ -51,6 +51,7 @@ jobs:
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
## `check-issue`
@@ -135,6 +136,7 @@ jobs:
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
## `find-comments`
@@ -211,6 +213,7 @@ jobs:
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
## `lock-issues`
@@ -257,6 +260,7 @@ jobs:
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue
## `mark-assignees`