Skip to content

Commit

Permalink
fix: check inactive (#22)
Browse files Browse the repository at this point in the history
* fix: check inactive

* add
  • Loading branch information
xrkffgg authored Dec 29, 2020
1 parent f3809e0 commit 3cd2442
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 59 deletions.
38 changes: 30 additions & 8 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,15 @@ jobs:
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-day | Inactive days filtering | number | ✖ | v1.4 |
| inactive-label | The label name adding | string | ✖ | v1 |

- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
Expand Down Expand Up @@ -650,13 +651,14 @@ jobs:
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-day | Inactive days filtering | number | ✖ | v1.4 |

- `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
Expand Down Expand Up @@ -731,14 +733,15 @@ jobs:
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-day | Inactive days filtering | number | ✖ | v1.4 |

- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
- `issue-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
Expand Down Expand Up @@ -888,6 +891,25 @@ Click the `···` icon in the upper right corner of a comment, select `Copy lin

⏫ [Back to list](#List)

## ✨ Version

- Version rules
- Use two-level semantic version, such as v1, v1.1, v2, v2.1
- v1 represents the initial version
- The fixes and additions to the v1 version will be released to the v1.1 version
- When the released v1.x runs stable for a certain period of time, release the advanced v2 version
- The parameters in the API must use the largest version and above

- Version selection
- It is recommended to use the latest releases version. It can be seen in [releases](https://github.com/actions-cool/issues-helper/releases)
- You can also refer to the update log below to select the version
- It also supports the direct use of branch versions. Such as:

```yml
- name: Issues Helper
uses: actions-cool/issues-helper@main
```

## Actions Template

- You can directly use this [GitHub Actions workflow template](https://github.com/actions-cool/.github) repositorie template
Expand Down Expand Up @@ -929,19 +951,19 @@ At the same time, if you have any questions during use, you can also ask and inq
</td>
</tr>
<tr>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>ant-design</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>ant-design-vue</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>dumi</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>umi</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>vue-request</strong>
</td>
</tr>
Expand Down
38 changes: 30 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,15 @@ jobs:
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| contents | 为该评论增加 [reaction](#reactions-types) | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.4 |
| inactive-label | 新增标签名称 | string | ✖ | v1 |

- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
Expand Down Expand Up @@ -644,13 +645,14 @@ jobs:
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| contents | 为该评论增加 [reaction](#reactions-types) | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.4 |

- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
Expand Down Expand Up @@ -725,14 +727,15 @@ jobs:
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| contents | 为该评论增加 [reaction](#reactions-types) | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.4 |

- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
Expand Down Expand Up @@ -883,6 +886,25 @@ x2 + y2

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

## ✨ 版本

- 版本规则
- 采用两级语义化版本,如v1、v1.1、v2、v2.1
- v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
- API 中参数需使用其中最大及以上版本

- 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
- 同时也可参照下面的更新日志来选择版本
- 也支持直接使用分支版本。如:

```yml
- name: Issues Helper
uses: actions-cool/issues-helper@main
```

## Actions 模板

- 可直接使用这个 [GitHub Actions workflow template](https://github.com/actions-cool/.github) 仓库的模板
Expand Down Expand Up @@ -924,19 +946,19 @@ x2 + y2
</td>
</tr>
<tr>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>ant-design</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>ant-design-vue</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>dumi</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>umi</strong>
</td>
<td align="center" wdith="160">
<td align="center" width="160">
<strong>vue-request</strong>
</td>
</tr>
Expand Down
40 changes: 23 additions & 17 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6213,26 +6213,32 @@ async function doQueryIssues (owner, repo, labels, state, creator) {

const res = await octokit.issues.listForRepo(params);
let issues = [];
res.data.forEach(iss => {
const a = bodyIncludes ? iss.body.includes(bodyIncludes) : true;
const b = titleIncludes ? iss.title.includes(titleIncludes) : true;
/**
* Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request.
* For this reason, "Issues" endpoints may return both issues and pull requests in the response.
* You can identify pull requests by the pull_request key.
*/
if (a && b && iss.pull_request === undefined) {
if (inactiveDay && typeof(inactiveDay) === 'number') {
let lastTime = dayjs.utc().subtract(inactiveDay, 'day');
let updateTime = dayjs.utc(iss.updated_at);
if (updateTime.isSameOrBefore(lastTime)) {
let issueNumbers = [];
if (res.data.length) {
res.data.forEach(iss => {
const a = bodyIncludes ? iss.body.includes(bodyIncludes) : true;
const b = titleIncludes ? iss.title.includes(titleIncludes) : true;
/**
* Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request.
* For this reason, "Issues" endpoints may return both issues and pull requests in the response.
* You can identify pull requests by the pull_request key.
*/
if (a && b && iss.pull_request === undefined) {
if (inactiveDay) {
let lastTime = dayjs.utc().subtract(Number(inactiveDay), 'day');
let updateTime = dayjs.utc(iss.updated_at);
if (updateTime.isSameOrBefore(lastTime)) {
issues.push(iss);
issueNumbers.push(iss.number);
}
} else {
issues.push(iss);
issueNumbers.push(iss.number);
}
} else {
issues.push(iss);
}
}
})
})
core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`);
}

return issues;
};
Expand Down
9 changes: 6 additions & 3 deletions docs/advanced.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ jobs:
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-day | Inactive days filtering | number | ✖ | v1.4 |
| inactive-label | The label name adding | string | ✖ | v1 |
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
Expand Down Expand Up @@ -122,13 +123,14 @@ jobs:
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-day | Inactive days filtering | number | ✖ | v1.4 |

- `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
Expand Down Expand Up @@ -199,14 +201,15 @@ jobs:
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-day | Inactive days filtering | number | ✖ | v1.4 |

- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
- `issue-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
Expand Down
9 changes: 6 additions & 3 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ jobs:
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| contents | 为该评论增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.4 |
| inactive-label | 新增标签名称 | string | ✖ | v1 |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
Expand Down Expand Up @@ -118,13 +119,14 @@ jobs:
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| contents | 为该评论增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.4 |

- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
Expand Down Expand Up @@ -195,14 +197,15 @@ jobs:
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| contents | 为该评论增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.4 |

- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ toc: menu
- v1 represents the initial version
- The fixes and additions to the v1 version will be released to the v1.1 version
- When the released v1.x runs stable for a certain period of time, release the advanced v2 version
- It is recommended to use the largest version and above for the parameters in the API
- The parameters in the API must use the largest version and above

- Version selection
- It is recommended to use the latest releases version. It can be seen in [releases](https://github.com/actions-cool/issues-helper/releases)
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ toc: menu
- v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
- API 中参数建议使用其中最大及以上版本
- API 中参数需使用其中最大及以上版本

- 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
Expand Down
6 changes: 6 additions & 0 deletions docs/log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v1.4

`2020.12.29`

- fix: perfect `inactive-day` check. [#22](https://github.com/actions-cool/issues-helper/pull/22)

## v1.3

`2020.12.28`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "issue-helper",
"version": "1.3.0",
"version": "1.4.0",
"private": true,
"description": "Some operations on issue.",
"main": "src/main.js",
Expand Down
Loading

0 comments on commit 3cd2442

Please sign in to comment.