mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-19 18:25:58 +08:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
77e16f7f08 | ||
![]() |
26a4993608 | ||
![]() |
f3eb0a0a96 | ||
![]() |
a610082f8a | ||
![]() |
556cc4f66e | ||
![]() |
e0e6d4a469 | ||
![]() |
fac636e8a9 | ||
![]() |
a0d1612783 | ||
![]() |
49a9184d18 | ||
![]() |
5457ae8d7c | ||
![]() |
0071d48bea | ||
![]() |
25379ae1ea | ||
![]() |
9a2f8c1e68 | ||
![]() |
554782c560 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -7,7 +7,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x]
|
node-version: [20.x]
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
6
.github/workflows/preview-build.yml
vendored
6
.github/workflows/preview-build.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
name: Preview Build
|
name: Preview Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
zip -r dist.zip docs-dist
|
zip -r dist.zip docs-dist
|
||||||
|
|
||||||
- name: upload dist artifact
|
- name: upload dist artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist.zip
|
path: dist.zip
|
||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload PR number
|
- name: Upload PR number
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: pr
|
name: pr
|
||||||
path: ./pr-id.txt
|
path: ./pr-id.txt
|
||||||
|
8
.github/workflows/preview-deploy.yml
vendored
8
.github/workflows/preview-deploy.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
||||||
steps:
|
steps:
|
||||||
- name: download pr artifact
|
- name: download pr artifact
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: dawidd6/action-download-artifact@v6
|
||||||
with:
|
with:
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
name: pr
|
name: pr
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
run: echo "::set-output name=id::$(<pr-id.txt)"
|
run: echo "::set-output name=id::$(<pr-id.txt)"
|
||||||
|
|
||||||
- name: download dist artifact
|
- name: download dist artifact
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: dawidd6/action-download-artifact@v6
|
||||||
with:
|
with:
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
@@ -43,7 +43,7 @@ jobs:
|
|||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
body: |
|
body: |
|
||||||
🎊 PR Preview has been successfully built and deployed to https://issues-helper-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
|
🎊 PR Preview has been successfully built and deployed to https://issues-helper-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
|
||||||
|
|
||||||
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
|
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
|
||||||
|
|
||||||
<!-- Sticky Pull Request Comment -->
|
<!-- Sticky Pull Request Comment -->
|
||||||
@@ -69,7 +69,7 @@ jobs:
|
|||||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure'
|
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure'
|
||||||
steps:
|
steps:
|
||||||
- name: download pr artifact
|
- name: download pr artifact
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: dawidd6/action-download-artifact@v6
|
||||||
with:
|
with:
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
name: pr
|
name: pr
|
||||||
|
21
CHANGELOG.md
21
CHANGELOG.md
@@ -7,8 +7,29 @@
|
|||||||
🛠 refactor
|
🛠 refactor
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## v3.6.0
|
||||||
|
|
||||||
|
`2024.02.18`
|
||||||
|
|
||||||
|
- 🚀 feat: add assignees to find-issues. [#192](https://github.com/actions-cool/issues-helper/pull/192)
|
||||||
|
- 💄 chore: Bump runtime to node20. [#190](https://github.com/actions-cool/issues-helper/pull/190) [@danielcompton](https://github.com/danielcompton)
|
||||||
|
|
||||||
|
## 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
|
||||||
|
18
README.md
18
README.md
@@ -79,7 +79,7 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
|
|||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
<a href="https://github.com/umijs/dumi">
|
<a href="https://github.com/umijs/dumi">
|
||||||
<img src="https://gw.alipayobjects.com/zos/bmw-prod/d3e3eb39-1cd7-4aa5-827c-877deced6b7e/lalxt4g3_w256_h256.png" width="46"/>
|
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
@@ -116,7 +116,7 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
|
|||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
<a href="https://github.com/TuSimple/naive-ui">
|
<a href="https://github.com/TuSimple/naive-ui">
|
||||||
<img src="https://camo.githubusercontent.com/b8ebecade711b9ae1fa306e7a1c9dd680fb56b0e2b9f015fec9cbad343570353/68747470733a2f2f6e6169766575692e6f73732d636e2d686f6e676b6f6e672e616c6979756e63732e636f6d2f6e616976656c6f676f2e737667" width="46"/>
|
<img src="https://www.naiveui.com/assets/naivelogo-XQ1U1Js8.svg" width="46"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -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)
|
||||||
|
|
||||||
@@ -968,11 +975,12 @@ Find the current repository, the creator is k , the title contains `this` , the
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
[
|
[
|
||||||
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', created: '', updated: ''},
|
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', created: '', updated: ''},
|
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `issue-state`: The default is `open`. Other values are: `closed`, `all`
|
||||||
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
|
- `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
|
- 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
|
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
|
||||||
|
@@ -79,7 +79,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
<a href="https://github.com/umijs/dumi">
|
<a href="https://github.com/umijs/dumi">
|
||||||
<img src="https://gw.alipayobjects.com/zos/bmw-prod/d3e3eb39-1cd7-4aa5-827c-877deced6b7e/lalxt4g3_w256_h256.png" width="46"/>
|
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
<a href="https://github.com/TuSimple/naive-ui">
|
<a href="https://github.com/TuSimple/naive-ui">
|
||||||
<img src="https://camo.githubusercontent.com/b8ebecade711b9ae1fa306e7a1c9dd680fb56b0e2b9f015fec9cbad343570353/68747470733a2f2f6e6169766575692e6f73732d636e2d686f6e676b6f6e672e616c6979756e63732e636f6d2f6e616976656c6f676f2e737667" width="46"/>
|
<img src="https://www.naiveui.com/assets/naivelogo-XQ1U1Js8.svg" width="46"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -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 的创建时间
|
||||||
|
|
||||||
[⏫ 返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
@@ -970,8 +977,8 @@ jobs:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
[
|
[
|
||||||
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', created: '', updated: ''},
|
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', created: '', updated: ''},
|
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
2
USERS.js
2
USERS.js
@@ -77,7 +77,7 @@ const users = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: 'https://github.com/TuSimple/naive-ui',
|
url: 'https://github.com/TuSimple/naive-ui',
|
||||||
logo: 'https://camo.githubusercontent.com/b8ebecade711b9ae1fa306e7a1c9dd680fb56b0e2b9f015fec9cbad343570353/68747470733a2f2f6e6169766575692e6f73732d636e2d686f6e676b6f6e672e616c6979756e63732e636f6d2f6e616976656c6f676f2e737667',
|
logo: 'https://www.naiveui.com/assets/naivelogo-XQ1U1Js8.svg',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: 'https://github.com/element-plus/element-plus',
|
url: 'https://github.com/element-plus/element-plus',
|
||||||
|
@@ -119,5 +119,5 @@ outputs:
|
|||||||
description: 'Check issue'
|
description: 'Check issue'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node16
|
using: node20
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
30
dist/index.js
vendored
30
dist/index.js
vendored
@@ -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);
|
||||||
}
|
}
|
||||||
@@ -16588,6 +16599,7 @@ function doFindIssues() {
|
|||||||
title: issue.title,
|
title: issue.title,
|
||||||
body: issue.body,
|
body: issue.body,
|
||||||
state: issue.state,
|
state: issue.state,
|
||||||
|
assignees: issue.assignees.map(val => val.login),
|
||||||
created: issue.created_at,
|
created: issue.created_at,
|
||||||
updated: issue.updated_at,
|
updated: issue.updated_at,
|
||||||
};
|
};
|
||||||
@@ -16909,7 +16921,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;
|
||||||
|
@@ -60,5 +60,8 @@
|
|||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
"simple-git": "^2.46.0",
|
"simple-git": "^2.46.0",
|
||||||
"typescript": "^4.1.3"
|
"typescript": "^4.1.3"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"types-ramda": "0.29.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -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);
|
||||||
}
|
}
|
||||||
@@ -256,6 +272,7 @@ export async function doFindIssues() {
|
|||||||
title: issue.title,
|
title: issue.title,
|
||||||
body: issue.body,
|
body: issue.body,
|
||||||
state: issue.state,
|
state: issue.state,
|
||||||
|
assignees: issue.assignees.map(val => val.login),
|
||||||
created: issue.created_at,
|
created: issue.created_at,
|
||||||
updated: issue.updated_at,
|
updated: issue.updated_at,
|
||||||
};
|
};
|
||||||
|
@@ -74,8 +74,8 @@ export async function doCreateIssue(
|
|||||||
|
|
||||||
export async function doCreateLabel() {
|
export async function doCreateLabel() {
|
||||||
const name = core.getInput('label-name');
|
const name = core.getInput('label-name');
|
||||||
const color = core.getInput('label-color') || 'ededed';
|
const color = core.getInput('label-color');
|
||||||
const description = core.getInput('label-desc') || '';
|
const description = core.getInput('label-desc');
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
await ICE.createLabel(name, color, description);
|
await ICE.createLabel(name, color, description);
|
||||||
@@ -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) {
|
||||||
|
@@ -80,8 +80,6 @@ export class IssueHelperEngine implements IIssueHelperEngine {
|
|||||||
const issueNumber = core.getInput('issue-number') || defaultCtxNumber;
|
const issueNumber = core.getInput('issue-number') || defaultCtxNumber;
|
||||||
if (issueNumber) {
|
if (issueNumber) {
|
||||||
this.issueNumber = +issueNumber;
|
this.issueNumber = +issueNumber;
|
||||||
} else {
|
|
||||||
core.warning(`'issue-number' is missing or this action not needed yet!`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emoji = core.getInput('emoji') || '';
|
this.emoji = core.getInput('emoji') || '';
|
||||||
|
@@ -130,8 +130,8 @@ export class IssueCoreEngine implements IIssueCoreEngine {
|
|||||||
|
|
||||||
public async createLabel(
|
public async createLabel(
|
||||||
labelName: string,
|
labelName: string,
|
||||||
labelColor: string,
|
labelColor: string = 'ededed',
|
||||||
labelDescription: string | undefined,
|
labelDescription: string = '',
|
||||||
) {
|
) {
|
||||||
const { owner, repo, octokit } = this;
|
const { owner, repo, octokit } = this;
|
||||||
await octokit.issues.createLabel({
|
await octokit.issues.createLabel({
|
||||||
@@ -318,11 +318,19 @@ export class IssueCoreEngine implements IIssueCoreEngine {
|
|||||||
state: baseState,
|
state: baseState,
|
||||||
} = issue;
|
} = issue;
|
||||||
|
|
||||||
const baseLabelsName = baseLabels.map(({ name }: any) => name);
|
const baseLabelsName = baseLabels.map(({ name }) => name);
|
||||||
const baseAssignessName = baseAssigness?.map(({ login }: any) => login);
|
const baseAssignessName = baseAssigness?.map(({ login }) => login);
|
||||||
|
|
||||||
const newBody = body ? (mode === 'append' ? `${baseBody}\n${body}` : body) : baseBody;
|
const newBody = body ? (mode === 'append' ? `${baseBody}\n${body}` : body) : baseBody;
|
||||||
|
|
||||||
|
if (labels && labels.length) {
|
||||||
|
for (const label of labels) {
|
||||||
|
if (baseLabelsName && baseLabelsName.length && baseLabelsName.indexOf(label) < 0) {
|
||||||
|
await this.createLabel(label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await octokit.issues.update({
|
await octokit.issues.update({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
|
@@ -83,7 +83,7 @@ export interface IIssueCoreEngine {
|
|||||||
createIssueEmoji: (emoji: TEmoji[]) => Promise<void>;
|
createIssueEmoji: (emoji: TEmoji[]) => Promise<void>;
|
||||||
createLabel: (
|
createLabel: (
|
||||||
labelName: string,
|
labelName: string,
|
||||||
labelColor: string,
|
labelColor: string | undefined,
|
||||||
labelDescription: string | undefined,
|
labelDescription: string | undefined,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user