Skip to content

Commit

Permalink
feat: add `$exclude-empty (#112)
Browse files Browse the repository at this point in the history
* feat: add `$exclude-empty

* docs: up

* chore: format
  • Loading branch information
xrkffgg authored Aug 26, 2022
1 parent 6672cf5 commit 982af7d
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 4 additions & 0 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@ jobs:
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue

⏫ [返回列表](#列-表)

Expand Down Expand Up @@ -861,6 +862,7 @@ jobs:
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue

⏫ [返回列表](#列-表)

Expand Down Expand Up @@ -941,6 +943,7 @@ jobs:

- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue

⏫ [返回列表](#列-表)

Expand Down Expand Up @@ -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

⏫ [返回列表](#列-表)

Expand Down
16 changes: 13 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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',
Expand All @@ -15921,6 +15928,9 @@ exports.ELockReasons = {
resolved: 'resolved',
spam: 'spam',
};
exports.EConst = {
ExcludeEmpty: '$exclude-empty',
};


/***/ }),
Expand Down
9 changes: 7 additions & 2 deletions src/helper/advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ export const ELockReasons = {
resolved: 'resolved',
spam: 'spam',
};

export const EConst = {
ExcludeEmpty: '$exclude-empty',
};
4 changes: 4 additions & 0 deletions web/docs/advanced.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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`

Expand Down
4 changes: 4 additions & 0 deletions web/docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue

## `check-issue`

Expand Down Expand Up @@ -135,6 +136,7 @@ jobs:
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue

## `find-comments`

Expand Down Expand Up @@ -211,6 +213,7 @@ jobs:

- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
- `exclude-labels`: 设置包含 `$exclude-empty` 时,可排除无 label issue

## `lock-issues`

Expand Down Expand Up @@ -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`

Expand Down

0 comments on commit 982af7d

Please sign in to comment.