Compare commits

...

5 Commits

Author SHA1 Message Date
元凛
5457ae8d7c chore: update dist & changelog 2023-08-16 13:29:01 +08:00
Just Thomas Hiorth Misund
0071d48bea fix: assign assignees to the assignees field instead of body field (#163) 2023-08-16 13:24:08 +08:00
元凛
25379ae1ea docs: update changelog 2023-07-27 10:04:48 +08:00
元凛
9a2f8c1e68 perf: inactive-mode support more 2023-07-27 09:53:59 +08:00
元凛
554782c560 chore: update changelog 2023-07-19 10:06:17 +08:00
6 changed files with 75 additions and 20 deletions

View File

@@ -7,8 +7,22 @@
🛠 refactor 🛠 refactor
--> -->
## v3.5.2
`2023.08.16`
- 🐞 fix: return `issue-assignees` in the correct output field for `get-issue`. [#163](https://github.com/actions-cool/issues-helper/pull/163) [@misund](https://github.com/misund)
## v3.5.1
`2023.07.27`
- 💄 perf: `inactive-mode` support `issue-created` `comment-created`.
## v3.5.0 ## v3.5.0
`2023.07.19`
- 🚀 feat: support `inactive-mode`. Optional `comment`, which will check the last comment update time. [#158](https://github.com/actions-cool/issues-helper/pull/158) - 🚀 feat: support `inactive-mode`. Optional `comment`, which will check the last comment update time. [#158](https://github.com/actions-cool/issues-helper/pull/158)
## v3.4.0 ## v3.4.0

View File

@@ -792,7 +792,7 @@ jobs:
| body-includes | Body filtering | string | ✖ | | body-includes | Body filtering | string | ✖ |
| title-includes | Title filtering | string | ✖ | | title-includes | Title filtering | string | ✖ |
| inactive-day | Inactive days filtering | number | ✖ | | inactive-day | Inactive days filtering | number | ✖ |
| inactive-mode | Detect inactive mode, default `issue`, optional `comment`, which is the last comment update time | string | ✖ | | inactive-mode | Detect inactive mode, default `issue` | string | ✖ |
| inactive-label | The label name adding | string | ✖ | | inactive-label | The label name adding | string | ✖ |
| exclude-labels | Exclude labels filtering | string | ✖ | | exclude-labels | Exclude labels filtering | string | ✖ |
@@ -802,6 +802,13 @@ jobs:
- `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-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 - `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 - `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
- `inactive-mode`:
- Default `issue`: the issue updated time
- Optional `comment`: the last comment update time
- Optional `issue-created`: the issue created time
- Optional `comment-created`: the comment creation time
- You can also set multiple such as: `comment, issue-created`
- It will be detected with priority, the update time of the last comment will be detected first, if there is no comment, the creation time of the issue will be used
[⏫ Back to list](#List) [⏫ Back to list](#List)

View File

@@ -796,7 +796,7 @@ jobs:
| body-includes | 包含内容筛选 | string | ✖ | | body-includes | 包含内容筛选 | string | ✖ |
| title-includes | 包含标题筛选 | string | ✖ | | title-includes | 包含标题筛选 | string | ✖ |
| inactive-day | 非活跃天数筛选 | number | ✖ | | inactive-day | 非活跃天数筛选 | number | ✖ |
| inactive-mode | 检测不活跃的模式,默认 `issue`,可选 `comment`,即为最后一个评论更新时间 | string | ✖ | | inactive-mode | 检测不活跃的模式 | string | ✖ |
| inactive-label | 新增标签名称 | string | ✖ | | inactive-label | 新增标签名称 | string | ✖ |
| exclude-labels | 排除标签筛选 | string | ✖ | | exclude-labels | 排除标签筛选 | string | ✖ |
@@ -806,6 +806,13 @@ jobs:
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有 - `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建 - `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue - `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
- `inactive-mode`:
- 默认 `issue`,检查 issue 的更新时间
- 可选 `comment`,检查最后一个评论的更新时间
- 可选 `issue-created`,检查 issue 的创建时间
- 可选 `comment-created`,最后一个评论的创建时间
- 你也可以设置多个如:`comment, issue-created`
- 将会以优先级检测,先检测最后一条评论更新时间,如无评论,则使用 issue 的创建时间
[⏫ 返回列表](#列-表) [⏫ 返回列表](#列-表)

29
dist/index.js vendored
View File

@@ -16408,16 +16408,27 @@ function doQueryIssues(state, creator, ignoreLabels) {
dayjs_1.default.extend(utc_1.default); dayjs_1.default.extend(utc_1.default);
dayjs_1.default.extend(isSameOrBefore_1.default); dayjs_1.default.extend(isSameOrBefore_1.default);
const lastTime = dayjs_1.default.utc().subtract(+inactiveDay, 'day'); const lastTime = dayjs_1.default.utc().subtract(+inactiveDay, 'day');
const inactiveMode = core.getInput('inactive-mode') || 'issue'; const inactiveMode = (0, actions_util_1.dealStringToArr)(core.getInput('inactive-mode'));
let updateTime = dayjs_1.default.utc(issue.updated_at); let checkTime = null;
if (inactiveMode === 'comment') { for (const mode of inactiveMode) {
ICE.setIssueNumber(issue.number); if (checkTime) {
const comments = yield ICE.listComments(); break;
if (comments.length) { }
updateTime = dayjs_1.default.utc(comments[comments.length - 1].updated_at); if (mode === 'comment' || mode === 'comment-created') {
ICE.setIssueNumber(issue.number);
const comments = yield ICE.listComments();
if (comments.length) {
checkTime = dayjs_1.default.utc(comments[comments.length - 1][mode === 'comment' ? 'updated_at' : 'created_at']);
}
}
if (mode === 'issue-created') {
checkTime = dayjs_1.default.utc(issue.created_at);
} }
} }
if (updateTime && updateTime.isSameOrBefore(lastTime)) { if (!checkTime) {
checkTime = dayjs_1.default.utc(issue.updated_at);
}
if (checkTime && checkTime.isSameOrBefore(lastTime)) {
issues.push(issue); issues.push(issue);
issueNumbers.push(issue.number); issueNumbers.push(issue.number);
} }
@@ -16909,7 +16920,7 @@ function doGetIssue() {
const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : ''; const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : '';
core.setOutput('issue-labels', labelsString); core.setOutput('issue-labels', labelsString);
const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : ''; const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : '';
core.setOutput('issue-body', assigneesString); core.setOutput('issue-assignees', assigneesString);
}); });
} }
exports.doGetIssue = doGetIssue; exports.doGetIssue = doGetIssue;

View File

@@ -85,16 +85,32 @@ export async function doQueryIssues(
const lastTime = dayjs.utc().subtract(+inactiveDay, 'day'); const lastTime = dayjs.utc().subtract(+inactiveDay, 'day');
const inactiveMode = core.getInput('inactive-mode') || 'issue'; const inactiveMode = dealStringToArr(core.getInput('inactive-mode'));
let updateTime = dayjs.utc(issue.updated_at); let checkTime: dayjs.Dayjs | null = null;
if (inactiveMode === 'comment') {
ICE.setIssueNumber(issue.number); for (const mode of inactiveMode) {
const comments = await ICE.listComments(); if (checkTime) {
if (comments.length) { break;
updateTime = dayjs.utc(comments[comments.length - 1].updated_at); }
if (mode === 'comment' || mode === 'comment-created') {
ICE.setIssueNumber(issue.number);
const comments = await ICE.listComments();
if (comments.length) {
checkTime = dayjs.utc(
comments[comments.length - 1][mode === 'comment' ? 'updated_at' : 'created_at'],
);
}
}
if (mode === 'issue-created') {
checkTime = dayjs.utc(issue.created_at);
} }
} }
if (updateTime && updateTime.isSameOrBefore(lastTime)) {
if (!checkTime) {
checkTime = dayjs.utc(issue.updated_at);
}
if (checkTime && checkTime.isSameOrBefore(lastTime)) {
issues.push(issue); issues.push(issue);
issueNumbers.push(issue.number); issueNumbers.push(issue.number);
} }

View File

@@ -104,7 +104,7 @@ export async function doGetIssue() {
const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : ''; const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : '';
core.setOutput('issue-labels', labelsString); core.setOutput('issue-labels', labelsString);
const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : ''; const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : '';
core.setOutput('issue-body', assigneesString); core.setOutput('issue-assignees', assigneesString);
} }
export async function doLockIssue(issueNumber?: number) { export async function doLockIssue(issueNumber?: number) {