diff --git a/.umirc.dev.ts b/.umirc.dev.ts
index 68cfc3a..148ea7f 100644
--- a/.umirc.dev.ts
+++ b/.umirc.dev.ts
@@ -1,4 +1,4 @@
export default {
base: '/',
- publicPath: '/',
+ publicPath: '/'
};
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5cb3c60..2382f7d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+## v1.7
+
+`2021.01.02`
+
+- [#27](https://github.com/actions-cool/issues-helper/pull/27)
+ - feat: add `month-statistics`
+ - fix: query issues less because pages max 100
+ - fix: js nested `require`
+
## v1.6
`2020.12.30`
diff --git a/README.en-US.md b/README.en-US.md
index 8317c79..00a20fe 100644
--- a/README.en-US.md
+++ b/README.en-US.md
@@ -49,6 +49,7 @@ When the following list does not have the features you want, you can submit it i
- [`close-issues`](#close-issues)
- [`find-comments`](#find-comments)
- [`lock-issues`](#lock-issues)
+ - [`month-statistics`](#month-statistics)
- 🌰 Example
- [`find-comments + create-comment + update-comment`](#find-comments--create-comment--update-comment)
@@ -74,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -82,18 +83,18 @@ jobs:
assignees: 'xxx' or 'xx1,xx2'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| assignees | Designated person. No operation when no input or empty character | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| assignees | Designated person. No operation when no input or empty character | string | ✖ |
- `actions` support multiple and separated by comma. Like: `add-assignees,add-labels`
- The `name` can be modified according to the actual situation
- [Reference to on](#github-docs)
- `${{ github.event.issue.number }}` is the current issue. [More references](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
-- `assignees` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
+- `assignees` support multiple and separated by comma
⏫ [Back to list](#List)
@@ -114,7 +115,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -122,14 +123,14 @@ jobs:
labels: 'bug' or 'xx1,xx2'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| labels | New labels. When it is not filled in or is empty character, do not add | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| labels | New labels. When it is not filled in or is empty character, do not add | string | ✖ |
-- `labels` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
+- `labels` support multiple and separated by comma
⏫ [Back to list](#List)
@@ -139,7 +140,7 @@ Close the specified issue.
```yml
- name: Close issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -147,11 +148,11 @@ Close the specified issue.
body: 'This is auto closed.'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
⏫ [Back to list](#List)
@@ -172,7 +173,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -184,19 +185,19 @@ jobs:
contents: '+1' or '+1,heart'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| body | Add comment content | string | ✖ | v1 |
-| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| body | Add comment content | string | ✖ |
+| contents | Add [reaction](#reactions-types) | string | ✖ |
- `body` default is `Currently at ${owner}/${repo}. And this is default comment.`
- Where `${owner}/${repo}` means the current repo
- Return `comment-id`, which can be used for subsequent operations. [Usage reference](#outputs-use)
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
-- `contents` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
+- `contents` support multiple and separated by comma
⏫ [Back to list](#List)
@@ -216,7 +217,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -227,15 +228,15 @@ jobs:
contents: '+1'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| title | The title of the new issue | string | ✖ | v1 |
-| body | The body of the new issue | string | ✖ | v1 |
-| labels | The labels for the new issue | string | ✖ | v1.1 |
-| assignees | The assignees for the new issue | string | ✖ | v1.1 |
-| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| title | The title of the new issue | string | ✖ |
+| body | The body of the new issue | string | ✖ |
+| labels | The labels for the new issue | string | ✖ |
+| assignees | The assignees for the new issue | string | ✖ |
+| contents | Add [reaction](#reactions-types) | string | ✖ |
- `title` default is `Default Title`
- Return `issue-number`. [Usage reference](#outputs-use)
@@ -248,18 +249,18 @@ According to [`comment-id`](#comment-id) delete the specified comment.
```yml
- name: Delete comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| comment-id | The comment ID | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| comment-id | The comment ID | number | ✔ |
⏫ [Back to list](#List)
@@ -280,18 +281,18 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
⏫ [Back to list](#List)
@@ -311,21 +312,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
- uses: actions-cool/issues-helper@v1.5
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.5 |
-| token | [Token explain](#token) | string | ✔ | v1.5 |
-| duplicate-command | Simple commands can be set, such as: `/d` | string | ✖ | v1.6 |
-| duplicate-labels | Add additional labels to this issue | string | ✖ | v1.5 |
-| labels | Replace the labels of the issue | string | ✖ | v1.5 |
-| contents | Add [reaction](#reactions-types) for this comment | string | ✖ | v1.5 |
-| close-issue | Whether to close the issue at the same time | string | ✖ | v1.6 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| duplicate-command | Simple commands can be set, such as: `/d` | string | ✖ |
+| duplicate-labels | Add additional labels to this issue | string | ✖ |
+| labels | Replace the labels of the issue | string | ✖ |
+| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
+| close-issue | Whether to close the issue at the same time | string | ✖ |
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`
- `close-issue`: Both `true` or `'true'` can take effect
@@ -338,18 +339,18 @@ Open the specified issue.
```yml
- name: Open issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
⏫ [Back to list](#List)
@@ -359,7 +360,7 @@ Remove the person designated by issue.
```yml
- name: Remove assignees
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -367,12 +368,12 @@ Remove the person designated by issue.
assignees: 'xx'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ |
⏫ [Back to list](#List)
@@ -382,7 +383,7 @@ Remove the specified labels.
```yml
- name: Remove labels
- uses: actions-cool/issues-helper@v1.2
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -390,12 +391,12 @@ Remove the specified labels.
labels: 'xx'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.2 |
-| token | [Token explain](#token) | string | ✔ | v1.2 |
-| issue-number | The number of issue | number | ✔ | v1.2 |
-| labels | The removed labels. When it is a blank character, do not remove | string | ✔ | v1.2 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| labels | The removed labels. When it is a blank character, do not remove | string | ✔ |
- `labels` supports multiple, such as `x1,x2,x3`, only the labels added by the issue will be removed
@@ -407,7 +408,7 @@ Replace the labels of issue.
```yml
- name: Set labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -415,12 +416,12 @@ Replace the labels of issue.
labels: 'xx'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| labels | labels set. When empty characters, will remove all | string | ✔ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| labels | labels set. When empty characters, will remove all | string | ✔ |
⏫ [Back to list](#List)
@@ -430,18 +431,18 @@ Unlock the specified issue.
```yml
- name: Unlock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
⏫ [Back to list](#List)
@@ -463,7 +464,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -471,14 +472,14 @@ jobs:
contents: 'eyes'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| comment-id | The comment ID | number | ✔ | v1 |
-| body | Update the content of comment | string | ✖ | v1 |
-| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
-| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| comment-id | The comment ID | number | ✔ |
+| body | Update the content of comment | string | ✖ |
+| update-mode | Update mode. Default `replace`, another `append` | string | ✖ |
+| contents | Add [reaction](#reactions-types) | string | ✖ |
- When `body` is not entered, it will remain as it is
- When `update-mode` is `append`, additional operations will be performed. Anything other than `append` will be replaced. Only effective for `body`
@@ -491,7 +492,7 @@ Update the specified issue according to the `issue-number`.
```yml
- name: Update issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -505,18 +506,18 @@ Update the specified issue according to the `issue-number`.
contents: '+1'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| state | Modify the status of issue, optional value `open` `closed` | string | ✖ | v1 |
-| title | Modify the title of the issue | string | ✖ | v1 |
-| body | Modify the content of issue | string | ✖ | v1 |
-| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
-| labels | Replace the labels of issue | string | ✖ | v1.1 |
-| assignees | Replace the assignees of issue | string | ✖ | v1.1 |
-| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| state | Modify the status of issue, optional value `open` `closed` | string | ✖ |
+| title | Modify the title of the issue | string | ✖ |
+| body | Modify the content of issue | string | ✖ |
+| update-mode | Update mode. Default `replace`, another `append` | string | ✖ |
+| labels | Replace the labels of issue | string | ✖ |
+| assignees | Replace the assignees of issue | string | ✖ |
+| contents | Add [reaction](#reactions-types) | string | ✖ |
- `state` defaults to `open`
- When the option is not filled, it will keep the original
@@ -541,7 +542,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
- uses: actions-cool/issues-helper@v1.3
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -551,14 +552,14 @@ jobs:
issue-contents: '+1, -1, eyes'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.3 |
-| token | [Token explain](#token) | string | ✔ | v1.3 |
-| body | Comment on the welcome content, no comment if you leave it blank | string | ✖ | v1.3 |
-| labels | Add labels to this issue | string | ✖ | v1.3 |
-| assignees | Add assignees to this issue | string | ✖ | v1.3 |
-| issue-contents | Add [reaction](#reactions-types) to this issue| string | ✖ | v1.3 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| body | Comment on the welcome content, no comment if you leave it blank | string | ✖ |
+| labels | Add labels to this issue | string | ✖ |
+| assignees | Add assignees to this issue | string | ✖ |
+| issue-contents | Add [reaction](#reactions-types) to this issue| string | ✖ |
- If these 4 options are not filled, no operation
@@ -584,28 +585,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| 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.4 |
-| inactive-label | The label name adding | string | ✖ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
+| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
+| labels | Labels filtering | string | ✖ |
+| issue-state | State filtering | string | ✖ |
+| issue-assignee | Assignee filtering | string | ✖ |
+| issue-creator | Creator filtering | string | ✖ |
+| issue-mentioned | Mentioned filtering | string | ✖ |
+| body-includes | Body filtering | string | ✖ |
+| title-includes | Title filtering | string | ✖ |
+| inactive-day | Inactive days filtering | number | ✖ |
+| inactive-label | The label name adding | string | ✖ |
- `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`
@@ -637,7 +638,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -646,14 +647,14 @@ jobs:
title-includes: 'x1,x2/y1,y2'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.2 |
-| token | [Token explain](#token) | string | ✔ | v1.2 |
-| issue-number | The number of issue | number | ✔ | v1.2 |
-| assignee-includes | Assignees contains check | string | ✖ | v1.2 |
-| title-includes | Title contains check | string | ✖ | v1.2 |
-| body-includes | Body contains check | string | ✖ | v1.2 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| assignee-includes | Assignees contains check | string | ✖ |
+| title-includes | Title contains check | string | ✖ |
+| body-includes | Body contains check | string | ✖ |
- `title-includes` `body-includes` supports the format `x1,x2` or `x1,x2/y1,y2`. Only supports two levels
- Return `check-result`
@@ -676,7 +677,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -684,19 +685,19 @@ jobs:
inactive-day: 7
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
+| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
+| labels | Labels filtering | string | ✖ |
+| issue-assignee | Assignee filtering | string | ✖ |
+| issue-creator | Creator filtering | string | ✖ |
+| issue-mentioned | Mentioned filtering | string | ✖ |
+| body-includes | Body filtering | string | ✖ |
+| title-includes | Title filtering | string | ✖ |
+| inactive-day | Inactive days filtering | number | ✖ |
- `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
@@ -710,7 +711,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
```yml
- name: Find comments
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -719,14 +720,14 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
body-includes: 'this'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](#token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| comment-auth | Comment creator, all will be queried if not filled | string | ✖ | v1 |
-| body-includes | Comment content includes filtering, no verification if not filled | string | ✖ | v1 |
-| direction | Return `comments` sort | string | ✖ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| comment-auth | Comment creator, all will be queried if not filled | string | ✖ |
+| body-includes | Comment content includes filtering, no verification if not filled | string | ✖ |
+| direction | Return `comments` sort | string | ✖ |
- Return `comments` in the following format:
@@ -758,7 +759,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -766,20 +767,20 @@ jobs:
inactive-day: 128
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
+| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
+| labels | Labels filtering | string | ✖ |
+| issue-state | State filtering | string | ✖ |
+| issue-assignee | Assignee filtering | string | ✖ |
+| issue-creator | Creator filtering | string | ✖ |
+| issue-mentioned | Mentioned filtering | string | ✖ |
+| body-includes | Body filtering | string | ✖ |
+| title-includes | Title filtering | string | ✖ |
+| inactive-day | Inactive days filtering | number | ✖ |
- `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`
@@ -788,6 +789,44 @@ jobs:
⏫ [Back to list](#List)
+#### `month-statistics`
+
+At 1 o'clock on the 1st of each month, an issue is generated for the statistics of the previous month.
+
+```
+name: Issue Month Statistics
+
+on:
+ schedule:
+ - cron: "0 1 1 * *"
+
+jobs:
+ month-statistics:
+ runs-on: ubuntu-latest
+ steps:
+ - name: month-statistics
+ uses: actions-cool/issues-helper@v1.7
+ with:
+ actions: 'month-statistics'
+ token: ${{ secrets.GITHUB_TOKEN }}
+ count-lables: 'true'
+```
+
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](#token) | string | ✔ |
+| labels | The labels for the new issue | string | ✖ |
+| assignees | The assignees for the new issue | string | ✖ |
+| count-lables | Whether the new issue count labels | string | ✖ |
+| count-comments | Whether the new issue count comments | string | ✖ |
+
+- The new issue title defaults to `[Current repo] Month Statistics: Year-Month`
+- `count-lables`: You can set `'true'` to add labels statistics
+- `count-comments`: You can set `'true'` to add comments statistics
+
+⏫ [Back to list](#List)
+
## 🌰 Example
Flexible reference.
@@ -809,7 +848,7 @@ jobs:
if: github.event.label.name == 'watch'
steps:
- name: find comments
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
id: fcid
with:
actions: 'find-comments'
@@ -820,7 +859,7 @@ jobs:
- name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }}
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -829,7 +868,7 @@ jobs:
- name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }}
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -861,7 +900,7 @@ When the token is not filled in actions or the corresponding secrets are not add
```yml
- name: Create issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
id: createissue
with:
actions: 'create-issue'
@@ -936,7 +975,6 @@ Click the `···` icon in the upper right corner of a comment, select `Copy lin
- 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)
diff --git a/README.md b/README.md
index 414d868..72f6671 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,7 @@
- [`close-issues`](#close-issues)
- [`find-comments`](#find-comments)
- [`lock-issues`](#lock-issues)
+ - [`month-statistics`](#month-statistics)
- 🌰 例 子
- [`find-comments + create-comment + update-comment`](#find-comments--create-comment--update-comment)
@@ -74,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -82,18 +83,18 @@ jobs:
assignees: 'xxx' or 'xx1,xx2'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ |
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改
- [on 参考](#github-docs)
- `${{ github.event.issue.number }}` 表示当前 issue,[更多参考](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
-- `assignees` 支持多个,需用逗号隔开。注意设置多个,需使用v1.1以上版本
+- `assignees` 支持多个,需用逗号隔开
⏫ [返回列表](#列-表)
@@ -114,7 +115,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -122,14 +123,14 @@ jobs:
labels: 'bug' or 'bug1,bug2'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| labels | 新增的 labels。当不填或者为空字符时,不新增 | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| labels | 新增的 labels。当不填或者为空字符时,不新增 | string | ✖ |
-- `labels` 支持多个,需用逗号隔开。注意设置多个,需使用v1.1以上版本
+- `labels` 支持多个,需用逗号隔开
⏫ [返回列表](#列-表)
@@ -139,7 +140,7 @@ jobs:
```yml
- name: Close issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -147,11 +148,11 @@ jobs:
body: 'This is auto closed.'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
⏫ [返回列表](#列-表)
@@ -172,7 +173,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -184,19 +185,19 @@ jobs:
contents: '+1' or '+1,heart'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| body | 新增评论的内容 | string | ✖ | v1 |
-| contents | 为新增评论的增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| body | 新增评论的内容 | string | ✖ |
+| contents | 为新增评论的增加 [reaction](#reactions-types) | string | ✖ |
- `body` 默认为:`Currently at ${owner}/${repo}. And this is default comment.`
- 其中 `${owner}/${repo}` 表示当前仓库
- 返回 `comment-id`,可用于之后操作。[用法参考](#outputs-使用)
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
-- `contents` 支持多个,需用逗号隔开。注意设置多个,需使用v1.1以上版本
+- `contents` 支持多个,需用逗号隔开
⏫ [返回列表](#列-表)
@@ -216,7 +217,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -227,15 +228,15 @@ jobs:
contents: '+1'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| title | 新增 issue 的标题 | string | ✖ | v1 |
-| body | 新增 issue 的内容 | string | ✖ | v1 |
-| labels | 为新增 issue 添加 labels | string | ✖ | v1.1 |
-| assignees | 为新增 issue 添加 assignees | string | ✖ | v1.1 |
-| contents | 为新增 issue 增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| title | 新增 issue 的标题 | string | ✖ |
+| body | 新增 issue 的内容 | string | ✖ |
+| labels | 为新增 issue 添加 labels | string | ✖ |
+| assignees | 为新增 issue 添加 assignees | string | ✖ |
+| contents | 为新增 issue 增加 [reaction](#reactions-types) | string | ✖ |
- `title` 默认为:`Default Title`
- 返回 `issue-number`,[用法参考](#outputs-使用)
@@ -248,18 +249,18 @@ jobs:
```yml
- name: Delete comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| comment-id | 指定的 comment | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| comment-id | 指定的 comment | number | ✔ |
⏫ [返回列表](#列-表)
@@ -280,18 +281,18 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
⏫ [返回列表](#列-表)
@@ -311,21 +312,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
- uses: actions-cool/issues-helper@v1.5
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.5 |
-| token | [token 说明](#token) | string | ✔ | v1.5 |
-| duplicate-command | 可设置简洁命令,如:`/d` | string | ✖ | v1.6 |
-| duplicate-labels | 为该 issue 额外增加 labels | string | ✖ | v1.5 |
-| labels | 替换该 issue 的 labels | string | ✖ | v1.5 |
-| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ | v1.5 |
-| close-issue | 是否同时关闭该 issue | string | ✖ | v1.6 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| duplicate-command | 可设置简洁命令,如:`/d` | string | ✖ |
+| duplicate-labels | 为该 issue 额外增加 labels | string | ✖ |
+| labels | 替换该 issue 的 labels | string | ✖ |
+| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
+| close-issue | 是否同时关闭该 issue | string | ✖ |
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`
- `close-issue`:`true` 或 `'true'` 均可生效
@@ -338,18 +339,18 @@ jobs:
```yml
- name: Open issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
⏫ [返回列表](#列-表)
@@ -359,7 +360,7 @@ jobs:
```yml
- name: Remove assignees
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -367,12 +368,12 @@ jobs:
assignees: 'xx'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ |
⏫ [返回列表](#列-表)
@@ -382,7 +383,7 @@ jobs:
```yml
- name: Remove labels
- uses: actions-cool/issues-helper@v1.2
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -390,12 +391,12 @@ jobs:
labels: 'xx'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.2 |
-| token | [token 说明](#token) | string | ✔ | v1.2 |
-| issue-number | 指定的 issue | number | ✔ | v1.2 |
-| labels | 移除的 labels。当为空字符时,不进行移除 | string | ✔ | v1.2 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| labels | 移除的 labels。当为空字符时,不进行移除 | string | ✔ |
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
@@ -407,7 +408,7 @@ jobs:
```yml
- name: Set labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -415,12 +416,12 @@ jobs:
labels: 'xx'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| labels | labels 设置。当空字符时,会移除所有 | string | ✔ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| labels | labels 设置。当空字符时,会移除所有 | string | ✔ |
⏫ [返回列表](#列-表)
@@ -430,18 +431,18 @@ jobs:
```yml
- name: Unlock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
⏫ [返回列表](#列-表)
@@ -463,7 +464,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -471,14 +472,14 @@ jobs:
contents: 'eyes'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| comment-id | 指定的 comment | number | ✔ | v1 |
-| body | 更新 comment 的内容 | string | ✖ | v1 |
-| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
-| contents | 增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| comment-id | 指定的 comment | number | ✔ |
+| body | 更新 comment 的内容 | string | ✖ |
+| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ |
+| contents | 增加 [reaction](#reactions-types) | string | ✖ |
- `body` 不填时,会保持原有
- `update-mode` 为 `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
@@ -491,7 +492,7 @@ jobs:
```yml
- name: Update issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -505,18 +506,18 @@ jobs:
contents: '+1'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| state | 修改 issue 的状态,可选值 `open` `closed` | string | ✖ | v1 |
-| title | 修改 issue 的标题 | string | ✖ | v1 |
-| body | 修改 issue 的内容 | string | ✖ | v1 |
-| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
-| labels | 替换 issue 的 labels | string | ✖ | v1.1 |
-| assignees | 替换 issue 的 assignees | string | ✖ | v1.1 |
-| contents | 增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| state | 修改 issue 的状态,可选值 `open` `closed` | string | ✖ |
+| title | 修改 issue 的标题 | string | ✖ |
+| body | 修改 issue 的内容 | string | ✖ |
+| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ |
+| labels | 替换 issue 的 labels | string | ✖ |
+| assignees | 替换 issue 的 assignees | string | ✖ |
+| contents | 增加 [reaction](#reactions-types) | string | ✖ |
- `state` 默认为 `open`
- 当可选项不填时,会保持原有
@@ -539,7 +540,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
- uses: actions-cool/issues-helper@v1.3
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -549,14 +550,14 @@ jobs:
issue-contents: '+1, -1, eyes'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.3 |
-| token | [token 说明](#token) | string | ✔ | v1.3 |
-| body | 评论欢迎的内容,不填则不评论 | string | ✖ | v1.3 |
-| labels | 为该 issue 增加 labels | string | ✖ | v1.3 |
-| assignees | 为该 issue 增加 assignees | string | ✖ | v1.3 |
-| issue-contents | 为该 issue 增加 [reaction](#reactions-types) | string | ✖ | v1.3 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| body | 评论欢迎的内容,不填则不评论 | string | ✖ |
+| labels | 为该 issue 增加 labels | string | ✖ |
+| assignees | 为该 issue 增加 assignees | string | ✖ |
+| issue-contents | 为该 issue 增加 [reaction](#reactions-types) | string | ✖ |
- 若这 4 个可选项都不填,则无操作
@@ -582,31 +583,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| 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.4 |
-| inactive-label | 新增标签名称 | string | ✖ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
+| contents | 为该评论增加 [reaction](#reactions-types) | string | ✖ |
+| labels | 标签筛选 | string | ✖ |
+| issue-state | 状态筛选 | string | ✖ |
+| issue-assignee | 指定人筛选 | string | ✖ |
+| issue-creator | 创建人筛选 | string | ✖ |
+| issue-mentioned | 提及人筛选 | string | ✖ |
+| body-includes | 包含内容筛选 | string | ✖ |
+| title-includes | 包含标题筛选 | string | ✖ |
+| inactive-day | 非活跃天数筛选 | number | ✖ |
+| inactive-label | 新增标签名称 | string | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
-- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
+- `issue-state`:默认为 `open`。可选值 `all` `closed`,非这 2 项时,均为 `open`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
@@ -631,7 +632,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -640,14 +641,14 @@ jobs:
title-includes: 'x1,x2/y1,y2'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.2 |
-| token | [token 说明](#token) | string | ✔ | v1.2 |
-| issue-number | 指定的 issue | number | ✔ | v1.2 |
-| assignee-includes | 是否包含指定人 | string | ✖ | v1.2 |
-| title-includes | 标题包含校验 | string | ✖ | v1.2 |
-| body-includes | 内容包含校验 | string | ✖ | v1.2 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| assignee-includes | 是否包含指定人 | string | ✖ |
+| title-includes | 标题包含校验 | string | ✖ |
+| body-includes | 内容包含校验 | string | ✖ |
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
- 返回 `check-result`
@@ -670,7 +671,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -678,19 +679,19 @@ jobs:
inactive-day: 7
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
+| contents | 为该评论增加 [reaction](#reactions-types) | string | ✖ |
+| labels | 标签筛选 | string | ✖ |
+| issue-assignee | 指定人筛选 | string | ✖ |
+| issue-creator | 创建人筛选 | string | ✖ |
+| issue-mentioned | 提及人筛选 | string | ✖ |
+| body-includes | 包含内容筛选 | string | ✖ |
+| title-includes | 包含标题筛选 | string | ✖ |
+| inactive-day | 非活跃天数筛选 | number | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
@@ -704,7 +705,7 @@ jobs:
```yml
- name: Find comments
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -713,14 +714,14 @@ jobs:
body-includes: 'this'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](#token) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ | v1 |
-| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ | v1 |
-| direction | 返回 `comments` 排序 | string | ✖ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ |
+| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ |
+| direction | 返回 `comments` 排序 | string | ✖ |
- 返回 `comments`,格式如下:
@@ -752,7 +753,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -760,28 +761,66 @@ jobs:
inactive-day: 128
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
+| contents | 为该评论增加 [reaction](#reactions-types) | string | ✖ |
+| labels | 标签筛选 | string | ✖ |
+| issue-state | 状态筛选 | string | ✖ |
+| issue-assignee | 指定人筛选 | string | ✖ |
+| issue-creator | 创建人筛选 | string | ✖ |
+| issue-mentioned | 提及人筛选 | string | ✖ |
+| body-includes | 包含内容筛选 | string | ✖ |
+| title-includes | 包含标题筛选 | string | ✖ |
+| inactive-day | 非活跃天数筛选 | number | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
-- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
+- `issue-state`:默认为 `open`。可选值 `all` `closed`,非这 2 项时,均为 `open`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
⏫ [返回列表](#列-表)
+#### `month-statistics`
+
+每月 1 号 1 时,生成一个 issue 上月统计。
+
+```
+name: Issue Month Statistics
+
+on:
+ schedule:
+ - cron: "0 1 1 * *"
+
+jobs:
+ month-statistics:
+ runs-on: ubuntu-latest
+ steps:
+ - name: month-statistics
+ uses: actions-cool/issues-helper@v1.7.7
+ with:
+ actions: 'month-statistics'
+ token: ${{ secrets.GITHUB_TOKEN }}
+ count-lables: 'true'
+```
+
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](#token) | string | ✔ |
+| labels | 为新增 issue 添加 labels | string | ✖ |
+| assignees | 为新增 issue 添加 assignees | string | ✖ |
+| count-lables | 新增 issue 是否统计 labels | string | ✖ |
+| count-comments | 新增 issue 是否统计 comments | string | ✖ |
+
+- 新增 `issue` 的标题默认为 `[当前仓库] Month Statistics: 年-月`
+- `count-lables`:可设置 `'true'`,增加 labels 统计
+- `count-comments`:可设置 `'true'`,增加 comments 统计
+
+⏫ [返回列表](#列-表)
+
## 🌰 例 子
灵活参考。
@@ -803,7 +842,7 @@ jobs:
if: github.event.label.name == 'watch'
steps:
- name: find comments
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
id: fcid
with:
actions: 'find-comments'
@@ -814,7 +853,7 @@ jobs:
- name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }}
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -823,7 +862,7 @@ jobs:
- name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }}
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -855,7 +894,7 @@ jobs:
```yml
- name: Create issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
id: createissue
with:
actions: 'create-issue'
@@ -931,7 +970,6 @@ x2 + y2
- v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
- - API 中参数需使用其中最大及以上版本
- 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
diff --git a/action.yml b/action.yml
index beabd1e..07cf8cf 100644
--- a/action.yml
+++ b/action.yml
@@ -58,6 +58,10 @@ inputs:
description: 'For mark-duplicate add labels'
close-issue:
description: 'For mark-duplicate'
+ count-lables:
+ description: 'For month-statistics'
+ count-comments:
+ description: 'For month-statistics'
outputs:
issue-number:
description: 'Create Issue Number'
diff --git a/dist/index.js b/dist/index.js
index dea8933..3de25b1 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -6022,242 +6022,7 @@ function wrappy (fn, cb) {
/***/ }),
-/***/ 9319:
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-__webpack_require__(2437).config();
-const core = __webpack_require__(2186);
-const { Octokit } = __webpack_require__(5375);
-
-var dayjs = __webpack_require__(7401);
-var utc = __webpack_require__(4359);
-dayjs.extend(utc);
-var isSameOrBefore = __webpack_require__(9517);
-dayjs.extend(isSameOrBefore);
-
-const {
- doAddLabels,
- doCloseIssue,
- doCreateComment,
- doLockIssue
-} = __webpack_require__(9932);
-
-const { dealInput, matchKeyword } = __webpack_require__(6254);
-
-const token = core.getInput('token');
-const octokit = new Octokit({ auth: `token ${token}` });
-
-let direction = core.getInput("direction");
-direction = direction === 'desc' ? 'desc' : 'asc';
-
-const commentAuth = core.getInput("comment-auth");
-const bodyIncludes = core.getInput('body-includes');
-const titleIncludes = core.getInput('title-includes');
-const assigneeIncludes = core.getInput('assignee-includes');
-
-const issueCreator = core.getInput("issue-creator");
-const issueAssignee = core.getInput('issue-assignee');
-const issueMentioned = core.getInput('issue-mentioned');
-
-let issueState = core.getInput("issue-state") || 'all';
-
-if (issueState != 'open' && issueState != 'closed') {
- issueState = 'all';
-}
-
-const inactiveDay = core.getInput("inactive-day");
-const inactiveLabel = core.getInput("inactive-label") || 'inactive';
-
-async function doCheckInactive (owner, repo, labels) {
- const issues = await doQueryIssues(owner, repo, labels, issueState);
-
- if (issues.length) {
- for (let i = 0; i < issues.length; i++) {
- if (!JSON.stringify(issues[i].labels).includes(inactiveLabel)) {
- await doAddLabels(owner, repo, issues[i].number, inactiveLabel);
- if (core.getInput("body")) {
- await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
- }
- } else {
- core.info(`Actions: [add-inactive] issue ${issues[i].number} has label!`);
- }
- }
- } else {
- core.info(`Actions: [query-issues] empty!`);
- }
-};
-
-/**
- * 检查 issue 是否满足条件,满足返回 true
- * 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
- * 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
- */
-async function doCheckIssue (owner, repo, issueNumber) {
- var checkResult = true;
- const issue = await octokit.issues.get({
- owner,
- repo,
- issue_number: issueNumber
- });
-
- if (!!checkResult && assigneeIncludes) {
- let assigneesCheck = dealInput(assigneeIncludes);
- let checkAssignee = false;
- issue.data.assignees.forEach(it => {
- if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) {
- checkResult = true;
- checkAssignee = true;
- }
- })
- !checkAssignee ? checkResult = false : null;
- }
-
- if (!!checkResult && titleIncludes) {
- const titleArr = titleIncludes.split('/');
- const keyword1 = dealInput(titleArr[0]);
- const keyword2 = dealInput(titleArr[1]);
- checkResult =
- keyword2.length ?
- matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) :
- matchKeyword(issue.data.title, keyword1);
- }
-
- if (!!checkResult && bodyIncludes) {
- const bodyArr = bodyIncludes.split('/');
- const keyword1 = dealInput(bodyArr[0]);
- const keyword2 = dealInput(bodyArr[1]);
- checkResult =
- keyword2.length ?
- matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) :
- matchKeyword(issue.data.body, keyword1);
- }
- core.info(`Actions: [check-issue][${!!checkResult}] success!`);
- core.setOutput("check-result", !!checkResult);
-};
-
-async function doCloseIssues (owner, repo, labels) {
- const issues = await doQueryIssues(owner, repo, labels, 'open');
-
- if (issues.length) {
- for (let i = 0; i < issues.length; i++) {
- await doCloseIssue(owner, repo, issues[i].number);
- if (core.getInput("body")) {
- await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
- }
- }
- } else {
- core.info(`Actions: [query-issues] empty!`);
- }
-};
-
-async function doFindComments (owner, repo, issueNumber) {
- const res = await octokit.issues.listComments({
- owner,
- repo,
- issue_number: issueNumber
- });
- core.info(`Actions: [find-comments][${issueNumber}] success!`);
- let comments = [];
- res.data.forEach(item => {
- const a = commentAuth ? item.user.login === commentAuth : true;
- const b = bodyIncludes ? item.body.includes(bodyIncludes) : true;
- if (a && b) {
- comments.push({
- id: item.id,
- auth: item.user.login,
- body: item.body,
- created: item.created_at,
- updated: item.updated_at
- })
- if (direction === 'desc') {
- comments.reverse();
- }
- }
- })
- core.setOutput("comments", comments);
-};
-
-async function doLockIssues (owner, repo, labels) {
- const issues = await doQueryIssues(owner, repo, labels, issueState);
-
- if (issues.length) {
- for (let i = 0; i < issues.length; i++) {
- await doLockIssue(owner, repo, issues[i].number);
- if (core.getInput("body")) {
- await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
- }
- }
- } else {
- core.info(`Actions: [query-issues] empty!`);
- }
-};
-
-async function doQueryIssues (owner, repo, labels, state, creator) {
- let params = {
- owner,
- repo,
- state,
- };
-
- issueCreator ? params.creator = issueCreator : null;
- issueAssignee ? params.assignee = issueAssignee : null;
- issueMentioned ? params.mentioned = issueMentioned : null;
-
- if (labels) {
- params.labels = labels;
- }
-
- if (creator) {
- params.creator = creator;
- }
-
- const res = await octokit.issues.listForRepo(params);
- let issues = [];
- 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);
- }
- }
- })
- core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`);
- }
-
- return issues;
-};
-
-module.exports = {
- doCheckInactive,
- doCheckIssue,
- doCloseIssues,
- doFindComments,
- doLockIssues,
-
- // tool
- doQueryIssues,
-};
-
-
-/***/ }),
-
-/***/ 9932:
+/***/ 9075:
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
__webpack_require__(2437).config();
@@ -6265,7 +6030,11 @@ const core = __webpack_require__(2186);
const github = __webpack_require__(5438);
const { Octokit } = __webpack_require__(5375);
-const { doQueryIssues } = __webpack_require__(9319);
+var dayjs = __webpack_require__(7401);
+var utc = __webpack_require__(4359);
+dayjs.extend(utc);
+var isSameOrBefore = __webpack_require__(9517);
+dayjs.extend(isSameOrBefore);
const ALLREACTIONS = [
"+1",
@@ -6278,16 +6047,46 @@ const ALLREACTIONS = [
"eyes",
];
-const { dealInput, testDuplicate } = __webpack_require__(6254);
+const {
+ dealInput,
+ matchKeyword,
+ testDuplicate,
+ getPreMonth
+} = __webpack_require__(6254);
const token = core.getInput('token');
+
const octokit = new Octokit({ auth: `token ${token}` });
const contents = core.getInput("contents");
const issueContents = core.getInput("issue-contents");
+// advanced
+let direction = core.getInput("direction");
+direction = direction === 'desc' ? 'desc' : 'asc';
+const commentAuth = core.getInput("comment-auth");
+const bodyIncludes = core.getInput('body-includes');
+const titleIncludes = core.getInput('title-includes');
+const assigneeIncludes = core.getInput('assignee-includes');
+
+const issueCreator = core.getInput("issue-creator");
+const issueAssignee = core.getInput('issue-assignee');
+const issueMentioned = core.getInput('issue-mentioned');
+
+let issueState = core.getInput("issue-state") || 'open';
+
+if (issueState != 'all' && issueState != 'closed') {
+ issueState = 'open';
+}
+
+const inactiveDay = core.getInput("inactive-day");
+const inactiveLabel = core.getInput("inactive-label") || 'inactive';
+const perPage = 100;
+
+// context
const context = github.context;
+// base
async function doAddAssignees (owner, repo, issueNumber, assignees) {
await octokit.issues.addAssignees({
owner,
@@ -6615,8 +6414,7 @@ async function doWelcome (owner, repo, assignees, labels, body) {
const auth = context.payload.sender.login;
core.info(`Actions: [welcome: auth=][${auth}]`);
const issueNumber = context.issue.number;
- const creator = 'zoo-js-bot';
- const issues = await doQueryIssues(owner, repo, false, 'all', creator);
+ const issues = await doQueryIssues(owner, repo, false, 'all', auth);
if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) {
if (core.getInput("body")) {
await doCreateComment(owner, repo, issueNumber, body);
@@ -6641,6 +6439,335 @@ async function doWelcome (owner, repo, assignees, labels, body) {
}
};
+// advanced
+async function doCheckInactive (owner, repo, labels) {
+ const issues = await doQueryIssues(owner, repo, labels, issueState);
+
+ if (issues.length) {
+ for (let i = 0; i < issues.length; i++) {
+ if (!JSON.stringify(issues[i].labels).includes(inactiveLabel)) {
+ await doAddLabels(owner, repo, issues[i].number, inactiveLabel);
+ if (core.getInput("body")) {
+ await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
+ }
+ } else {
+ core.info(`Actions: [add-inactive] issue ${issues[i].number} has label!`);
+ }
+ }
+ } else {
+ core.info(`Actions: [query-issues] empty!`);
+ }
+};
+
+/**
+ * 检查 issue 是否满足条件,满足返回 true
+ * 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
+ * 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
+ */
+async function doCheckIssue (owner, repo, issueNumber) {
+ var checkResult = true;
+ const issue = await octokit.issues.get({
+ owner,
+ repo,
+ issue_number: issueNumber
+ });
+
+ if (!!checkResult && assigneeIncludes) {
+ let assigneesCheck = dealInput(assigneeIncludes);
+ let checkAssignee = false;
+ issue.data.assignees.forEach(it => {
+ if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) {
+ checkResult = true;
+ checkAssignee = true;
+ }
+ })
+ !checkAssignee ? checkResult = false : null;
+ }
+
+ if (!!checkResult && titleIncludes) {
+ const titleArr = titleIncludes.split('/');
+ const keyword1 = dealInput(titleArr[0]);
+ const keyword2 = dealInput(titleArr[1]);
+ checkResult =
+ keyword2.length ?
+ matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) :
+ matchKeyword(issue.data.title, keyword1);
+ }
+
+ if (!!checkResult && bodyIncludes) {
+ const bodyArr = bodyIncludes.split('/');
+ const keyword1 = dealInput(bodyArr[0]);
+ const keyword2 = dealInput(bodyArr[1]);
+ checkResult =
+ keyword2.length ?
+ matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) :
+ matchKeyword(issue.data.body, keyword1);
+ }
+ core.info(`Actions: [check-issue][${!!checkResult}] success!`);
+ core.setOutput("check-result", !!checkResult);
+};
+
+async function doCloseIssues (owner, repo, labels) {
+ const issues = await doQueryIssues(owner, repo, labels, 'open');
+
+ if (issues.length) {
+ for (let i = 0; i < issues.length; i++) {
+ await doCloseIssue(owner, repo, issues[i].number);
+ if (core.getInput("body")) {
+ await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
+ }
+ }
+ } else {
+ core.info(`Actions: [query-issues] empty!`);
+ }
+};
+
+async function doFindComments (owner, repo, issueNumber) {
+ const res = await octokit.issues.listComments({
+ owner,
+ repo,
+ issue_number: issueNumber
+ });
+ core.info(`Actions: [find-comments][${issueNumber}] success!`);
+ let comments = [];
+ res.data.forEach(item => {
+ const a = commentAuth ? item.user.login === commentAuth : true;
+ const b = bodyIncludes ? item.body.includes(bodyIncludes) : true;
+ if (a && b) {
+ comments.push({
+ id: item.id,
+ auth: item.user.login,
+ body: item.body,
+ created: item.created_at,
+ updated: item.updated_at
+ })
+ if (direction === 'desc') {
+ comments.reverse();
+ }
+ }
+ })
+ core.setOutput("comments", comments);
+};
+
+async function doLockIssues (owner, repo, labels) {
+ const issues = await doQueryIssues(owner, repo, labels, issueState);
+
+ if (issues.length) {
+ for (let i = 0; i < issues.length; i++) {
+ await doLockIssue(owner, repo, issues[i].number);
+ if (core.getInput("body")) {
+ await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
+ }
+ }
+ } else {
+ core.info(`Actions: [query-issues] empty!`);
+ }
+};
+
+async function doMonthStatistics (owner, repo, labels, assignees) {
+ const countLables = core.getInput("count-lables");
+ const countComments = core.getInput("count-comments");
+
+ const thisMonth = dayjs.utc().month() + 1;
+ const year = thisMonth == 1 ? dayjs.utc().year() - 1 : dayjs.utc().year();
+
+ const month = getPreMonth(thisMonth);
+ const showMonth = month < 10 ? `0${month}` : month;
+
+ let issues = await getIssuesInMonth(
+ owner,
+ repo,
+ thisMonth
+ );
+ if (issues.length == 0) {
+ core.info(`Actions: [query-issues-${month}] empty!`);
+ return false;
+ }
+ issues = issues.filter(i => {
+ return getCreatedMontn(i.created_at) == month
+ });
+ let total = issues.length;
+ let totalIssues = [...issues];
+ let openTotal = 0;
+ let openIssuesNumber = [];
+ let closeTotal = 0;
+ let closeIssuesNumber = [];
+ let labelsTotals = [];
+ const title = `[${owner}/${repo}] Month Statistics: ${year}-${showMonth}`;
+ for (let i = 0; i < issues.length; i++) {
+ if (issues[i].state == 'closed') {
+ closeTotal += 1;
+ closeIssuesNumber.push(issues[i].number);
+ } else if (issues[i].state == 'open') {
+ openTotal += 1;
+ openIssuesNumber.push(issues[i].number);
+ }
+ if (countLables && issues[i].labels) {
+ issues[i].labels.forEach(l => {
+ if (l.name in labelsTotals) {
+ labelsTotals[l.name] += 1;
+ } else {
+ labelsTotals[l.name] = 1;
+ }
+ })
+ }
+ }
+ let now = dayjs().utc().format('YYYY-MM-DD HH:mm:ss');
+ let body = `
+- Created time: ${now}
+
+- Time base: UTC +0
+`;
+ let totalShow = `
+### Count
+
+| Total | Open | Closed |
+| -- | -- | -- |
+| ${total} | ${openTotal} | ${closeTotal} |
+
+`;
+
+ body += totalShow;
+
+ if (countLables == 'true') {
+ let labelsArr = [];
+ for (var lab in labelsTotals) {
+ labelsArr.push({
+ labelName: lab,
+ number: labelsTotals[lab]
+ })
+ }
+ labelsArr.sort((a, b) => b.number - a.number);
+ let labelsTitle = `
+### Labels statistics
+
+
+
+Name |
+Number |
+
`
+ let labelsBody = '';
+ labelsArr.forEach(it => {
+ labelsBody += `${it.labelName} | ${it.number} |
`
+ })
+ body = body + labelsTitle + labelsBody + `
+
+`;
+ }
+
+ if (countComments == 'true') {
+ totalIssues.sort((a, b) => b.comments - a.comments);
+ const maxComments = totalIssues.slice(0, 3);
+ let commentTitle = `
+### Most commente
+
+
+
+# |
+Issue |
+Title |
+Number |
+State |
+
+`
+ let commentBody = '';
+ maxComments.forEach((it,ind) => {
+ commentBody += `
+${ind + 1} |
+${it.number} |
+${it.title} |
+${it.comments} |
+${it.state} |
`
+ })
+ body = body + commentTitle + commentBody + '
';
+ }
+
+ await doCreateIssue(owner, repo, title, body, labels, assignees);
+};
+
+
+// Tool
+async function doQueryIssues (owner, repo, labels, state, creator) {
+ let params = {
+ owner,
+ repo,
+ state,
+ };
+
+ issueCreator ? params.creator = issueCreator : null;
+ issueAssignee ? params.assignee = issueAssignee : null;
+ issueMentioned ? params.mentioned = issueMentioned : null;
+
+ if (labels) {
+ params.labels = labels;
+ }
+
+ if (creator) {
+ params.creator = creator;
+ }
+
+ const res = await getIssues(params);
+ let issues = [];
+ let issueNumbers = [];
+ if (res.length) {
+ res.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);
+ }
+ }
+ })
+ core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`);
+ }
+
+ return issues;
+};
+
+async function getIssues (params, page = 1) {
+ let { data: issues } = await octokit.issues.listForRepo({
+ ...params,
+ per_page: perPage,
+ page
+ });
+ if (issues.length >= perPage) {
+ issues = issues.concat(await getIssues(params, page + 1));
+ }
+ return issues;
+};
+
+async function getIssuesInMonth (owner, repo, thisMonth, page = 1) {
+ const month = getPreMonth(thisMonth);
+ let { data: issues } = await octokit.issues.listForRepo({
+ owner,
+ repo,
+ state: 'all',
+ per_page: perPage,
+ page
+ });
+ issues = issues.filter(i => {
+ return i.pull_request === undefined
+ });
+ if (issues.length && getCreatedMontn(issues[issues.length - 1].created_at) >= month) {
+ issues = issues.concat(await getIssuesInMonth(owner, repo, thisMonth, page + 1));
+ }
+ return issues;
+};
+
// tool
function testContent(con) {
if (ALLREACTIONS.includes(con)) {
@@ -6651,8 +6778,13 @@ function testContent(con) {
}
};
+function getCreatedMontn (d) {
+ return dayjs(d).utc().month() + 1;
+};
+
// exports
module.exports = {
+ // base
doAddAssignees,
doAddLabels,
doCloseIssue,
@@ -6671,6 +6803,14 @@ module.exports = {
doUpdateComment,
doUpdateIssue,
doWelcome,
+
+ // advanced
+ doCheckInactive,
+ doCheckIssue,
+ doCloseIssues,
+ doFindComments,
+ doLockIssues,
+ doMonthStatistics,
};
@@ -6683,6 +6823,7 @@ const core = __webpack_require__(2186);
const github = __webpack_require__(5438);
const {
+ // base
doAddAssignees,
doAddLabels,
doCloseIssue,
@@ -6701,15 +6842,15 @@ const {
doUpdateComment,
doUpdateIssue,
doWelcome,
-} = __webpack_require__(9932);
-const {
+ // advanced
doCheckInactive,
doCheckIssue,
doCloseIssues,
doFindComments,
doLockIssues,
-} = __webpack_require__(9319);
+ doMonthStatistics,
+} = __webpack_require__(9075);
const ALLACTIONS = [
// base
@@ -6736,6 +6877,7 @@ const ALLACTIONS = [
'close-issues',
'find-comments',
'lock-issues',
+ 'month-statistics',
];
async function main() {
@@ -6888,6 +7030,14 @@ async function main() {
labels
);
break;
+ case 'month-statistics':
+ await doMonthStatistics(
+ owner,
+ repo,
+ labels,
+ assignees
+ );
+ break;
// default
default:
break;
@@ -6937,8 +7087,13 @@ function testDuplicate(body) {
}
};
+function getPreMonth (m) {
+ return m == 1 ? 12 : m -1;
+};
+
module.exports = {
dealInput,
+ getPreMonth,
matchKeyword,
testDuplicate,
};
diff --git a/docs/advanced.en-US.md b/docs/advanced.en-US.md
index 15a7315..db6647a 100644
--- a/docs/advanced.en-US.md
+++ b/docs/advanced.en-US.md
@@ -22,28 +22,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| 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.4 |
-| inactive-label | The label name adding | string | ✖ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ |
+| labels | Labels filtering | string | ✖ |
+| issue-state | State filtering | string | ✖ |
+| issue-assignee | Assignee filtering | string | ✖ |
+| issue-creator | Creator filtering | string | ✖ |
+| issue-mentioned | Mentioned filtering | string | ✖ |
+| body-includes | Body filtering | string | ✖ |
+| title-includes | Title filtering | string | ✖ |
+| inactive-day | Inactive days filtering | number | ✖ |
+| inactive-label | The label name adding | string | ✖ |
- `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`
@@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -82,14 +82,14 @@ jobs:
title-includes: 'x1,x2/y1,y2'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.2 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1.2 |
-| issue-number | The number of issue | number | ✔ | v1.2 |
-| assignee-includes | Assignees contains check | string | ✖ | v1.2 |
-| title-includes | Title contains check | string | ✖ | v1.2 |
-| body-includes | Body contains check | string | ✖ | v1.2 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| assignee-includes | Assignees contains check | string | ✖ |
+| title-includes | Title contains check | string | ✖ |
+| body-includes | Body contains check | string | ✖ |
- `title-includes` `body-includes` supports the format `x1,x2` or `x1,x2/y1,y2`. Only supports two levels
- Return `check-result`
@@ -110,7 +110,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -118,19 +118,19 @@ jobs:
inactive-day: 7
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ |
+| labels | Labels filtering | string | ✖ |
+| issue-assignee | Assignee filtering | string | ✖ |
+| issue-creator | Creator filtering | string | ✖ |
+| issue-mentioned | Mentioned filtering | string | ✖ |
+| body-includes | Body filtering | string | ✖ |
+| title-includes | Title filtering | string | ✖ |
+| inactive-day | Inactive days filtering | number | ✖ |
- `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
@@ -142,7 +142,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
```yml
- name: Find comments
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -151,14 +151,14 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
body-includes: 'this'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| comment-auth | Comment creator, all will be queried if not filled | string | ✖ | v1 |
-| body-includes | Comment content includes filtering, no verification if not filled | string | ✖ | v1 |
-| direction | Return `comments` sort | string | ✖ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| comment-auth | Comment creator, all will be queried if not filled | string | ✖ |
+| body-includes | Comment content includes filtering, no verification if not filled | string | ✖ |
+| direction | Return `comments` sort | string | ✖ |
- Return `comments` in the following format:
@@ -188,7 +188,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -196,22 +196,58 @@ jobs:
inactive-day: 128
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ |
+| labels | Labels filtering | string | ✖ |
+| issue-state | State filtering | string | ✖ |
+| issue-assignee | Assignee filtering | string | ✖ |
+| issue-creator | Creator filtering | string | ✖ |
+| issue-mentioned | Mentioned filtering | string | ✖ |
+| body-includes | Body filtering | string | ✖ |
+| title-includes | Title filtering | string | ✖ |
+| inactive-day | Inactive days filtering | number | ✖ |
- `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`
- `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
+
+## `month-statistics`
+
+At 1 o'clock on the 1st of each month, an issue is generated for the statistics of the previous month.
+
+```
+name: Issue Month Statistics
+
+on:
+ schedule:
+ - cron: "0 1 1 * *"
+
+jobs:
+ month-statistics:
+ runs-on: ubuntu-latest
+ steps:
+ - name: month-statistics
+ uses: actions-cool/issues-helper@v1.7
+ with:
+ actions: 'month-statistics'
+ token: ${{ secrets.GITHUB_TOKEN }}
+ count-lables: 'true'
+```
+
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| labels | The labels for the new issue | string | ✖ |
+| assignees | The assignees for the new issue | string | ✖ |
+| count-lables | Whether the new issue count labels | string | ✖ |
+| count-comments | Whether the new issue count comments | string | ✖ |
+
+- The new issue title defaults to `[Current repo] Month Statistics: Year-Month`
+- `count-lables`: You can set `'true'` to add labels statistics
+- `count-comments`: You can set `'true'` to add comments statistics
diff --git a/docs/advanced.md b/docs/advanced.md
index 3a41efa..ffdce3a 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -22,28 +22,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| 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.4 |
-| inactive-label | 新增标签名称 | string | ✖ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
+| contents | 为该评论增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
+| labels | 标签筛选 | string | ✖ |
+| issue-state | 状态筛选 | string | ✖ |
+| issue-assignee | 指定人筛选 | string | ✖ |
+| issue-creator | 创建人筛选 | string | ✖ |
+| issue-mentioned | 提及人筛选 | string | ✖ |
+| body-includes | 包含内容筛选 | string | ✖ |
+| title-includes | 包含标题筛选 | string | ✖ |
+| inactive-day | 非活跃天数筛选 | number | ✖ |
+| inactive-label | 新增标签名称 | string | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
@@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -78,14 +78,14 @@ jobs:
title-includes: 'x1,x2/y1,y2'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.2 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1.2 |
-| issue-number | 指定的 issue | number | ✔ | v1.2 |
-| assignee-includes | 是否包含指定人 | string | ✖ | v1.2 |
-| title-includes | 标题包含校验 | string | ✖ | v1.2 |
-| body-includes | 内容包含校验 | string | ✖ | v1.2 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| assignee-includes | 是否包含指定人 | string | ✖ |
+| title-includes | 标题包含校验 | string | ✖ |
+| body-includes | 内容包含校验 | string | ✖ |
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
- 返回 `check-result`
@@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -114,19 +114,19 @@ jobs:
inactive-day: 7
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
+| contents | 为该评论增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
+| labels | 标签筛选 | string | ✖ |
+| issue-assignee | 指定人筛选 | string | ✖ |
+| issue-creator | 创建人筛选 | string | ✖ |
+| issue-mentioned | 提及人筛选 | string | ✖ |
+| body-includes | 包含内容筛选 | string | ✖ |
+| title-includes | 包含标题筛选 | string | ✖ |
+| inactive-day | 非活跃天数筛选 | number | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
@@ -138,7 +138,7 @@ jobs:
```yml
- name: Find comments
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -147,14 +147,14 @@ jobs:
body-includes: 'this'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ | v1 |
-| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ | v1 |
-| direction | 返回 `comments` 排序 | string | ✖ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ |
+| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ |
+| direction | 返回 `comments` 排序 | string | ✖ |
- 返回 `comments`,格式如下:
@@ -184,7 +184,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -192,22 +192,58 @@ jobs:
inactive-day: 128
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| 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.4 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
+| contents | 为该评论增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
+| labels | 标签筛选 | string | ✖ |
+| issue-state | 状态筛选 | string | ✖ |
+| issue-assignee | 指定人筛选 | string | ✖ |
+| issue-creator | 创建人筛选 | string | ✖ |
+| issue-mentioned | 提及人筛选 | string | ✖ |
+| body-includes | 包含内容筛选 | string | ✖ |
+| title-includes | 包含标题筛选 | string | ✖ |
+| inactive-day | 非活跃天数筛选 | number | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
+
+## `month-statistics`
+
+每月 1 号 1 时,生成一个 issue 上月统计。
+
+```
+name: Issue Month Statistics
+
+on:
+ schedule:
+ - cron: "0 1 1 * *"
+
+jobs:
+ month-statistics:
+ runs-on: ubuntu-latest
+ steps:
+ - name: month-statistics
+ uses: actions-cool/issues-helper@v1.7
+ with:
+ actions: 'month-statistics'
+ token: ${{ secrets.GITHUB_TOKEN }}
+ count-lables: 'true'
+```
+
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明)) | string | ✔ |
+| labels | 为新增 issue 添加 labels | string | ✖ |
+| assignees | 为新增 issue 添加 assignees | string | ✖ |
+| count-lables | 新增 issue 是否统计 labels | string | ✖ |
+| count-comments | 新增 issue 是否统计 comments | string | ✖ |
+
+- 新增 `issue` 的标题默认为 `[当前仓库] Month Statistics: 年-月`
+- `count-lables`:可设置 `'true'`,增加 labels 统计
+- `count-comments`:可设置 `'true'`,增加 comments 统计
diff --git a/docs/base.en-US.md b/docs/base.en-US.md
index 06a7962..1d6c3b5 100644
--- a/docs/base.en-US.md
+++ b/docs/base.en-US.md
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -30,18 +30,18 @@ jobs:
assignees: 'xxx' or 'xx1,xx2'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| assignees | Designated person. No operation when no input or empty character | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| assignees | Designated person. No operation when no input or empty character | string | ✖ |
- `actions` support multiple and separated by comma. Like: `add-assignees,add-labels`
- The `name` can be modified according to the actual situation
- [Reference to on](/en-US/guide/ref#-github-docs)
- `${{ github.event.issue.number }}` is the current issue. [More references](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
-- `assignees` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
+- `assignees` support multiple and separated by comma
## `add-labels`
@@ -60,7 +60,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -68,14 +68,14 @@ jobs:
labels: 'bug' or 'xx1,xx2'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| labels | New labels. When it is not filled in or is empty character, do not add | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| labels | New labels. When it is not filled in or is empty character, do not add | string | ✖ |
-- `labels` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
+- `labels` support multiple and separated by comma
## `close-issue`
@@ -83,7 +83,7 @@ Close the specified issue.
```yml
- name: Close issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -91,11 +91,11 @@ Close the specified issue.
body: 'This is auto closed.'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
## `create-comment`
@@ -114,7 +114,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -126,19 +126,19 @@ jobs:
contents: '+1' or '+1,heart'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| body | Add comment content | string | ✖ | v1 |
-| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| body | Add comment content | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ |
- `body` default is `Currently at ${owner}/${repo}. And this is default comment.`
- Where `${owner}/${repo}` means the current repo
- Return `comment-id`, which can be used for subsequent operations. [Usage reference](/en-US/guide/ref#-outputs-use)
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
-- `contents` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
+- `contents` support multiple and separated by comma
## `create-issue`
@@ -156,7 +156,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -167,15 +167,15 @@ jobs:
contents: '+1'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| title | The title of the new issue | string | ✖ | v1 |
-| body | The body of the new issue | string | ✖ | v1 |
-| labels | The labels for the new issue | string | ✖ | v1.1 |
-| assignees | The assignees for the new issue | string | ✖ | v1.1 |
-| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| title | The title of the new issue | string | ✖ |
+| body | The body of the new issue | string | ✖ |
+| labels | The labels for the new issue | string | ✖ |
+| assignees | The assignees for the new issue | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ |
- `title` default is `Default Title`
- Return `issue-number`. [Usage reference](/en-US/guide/ref#-outputs-use)
@@ -186,18 +186,18 @@ According to [`comment-id`](/en-US/guide/ref#-comment-id) delete the specified c
```yml
- name: Delete comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| comment-id | The comment ID | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| comment-id | The comment ID | number | ✔ |
## `lock-issue`
@@ -216,18 +216,18 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
## `mark-duplicate`
@@ -245,21 +245,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
- uses: actions-cool/issues-helper@v1.5
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.5 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1.5 |
-| duplicate-command | Simple commands can be set, such as: `/d` | string | ✖ | v1.6 |
-| duplicate-labels | Add additional labels to this issue | string | ✖ | v1.5 |
-| labels | Replace the labels of the issue | string | ✖ | v1.5 |
-| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ | v1.5 |
-| close-issue | Whether to close the issue at the same time | string | ✖ | v1.6 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| duplicate-command | Simple commands can be set, such as: `/d` | string | ✖ |
+| duplicate-labels | Add additional labels to this issue | string | ✖ |
+| labels | Replace the labels of the issue | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ |
+| close-issue | Whether to close the issue at the same time | string | ✖ |
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`
- `close-issue`: Both `true` or `'true'` can take effect
@@ -276,18 +276,18 @@ Open the specified issue.
```yml
- name: Open issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
## `remove-assignees`
@@ -295,7 +295,7 @@ Remove the person designated by issue.
```yml
- name: Remove assignees
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -303,12 +303,12 @@ Remove the person designated by issue.
assignees: 'xx'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ |
## `remove-labels`
@@ -316,7 +316,7 @@ Remove the specified labels.
```yml
- name: Remove labels
- uses: actions-cool/issues-helper@v1.2
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -324,12 +324,12 @@ Remove the specified labels.
labels: 'xx'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.2 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1.2 |
-| issue-number | The number of issue | number | ✔ | v1.2 |
-| labels | The removed labels. When it is a blank character, do not remove | string | ✔ | v1.2 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| labels | The removed labels. When it is a blank character, do not remove | string | ✔ |
- `labels` supports multiple, such as `x1,x2,x3`, only the labels added by the issue will be removed
@@ -339,7 +339,7 @@ Replace the labels of issue.
```yml
- name: Set labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -347,12 +347,12 @@ Replace the labels of issue.
labels: 'xx'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| labels | labels set. When empty characters, will remove all | string | ✔ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| labels | labels set. When empty characters, will remove all | string | ✔ |
## `unlock-issue`
@@ -360,18 +360,18 @@ Unlock the specified issue.
```yml
- name: Unlock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
## `update-comment`
@@ -391,7 +391,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -399,14 +399,14 @@ jobs:
contents: 'eyes'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| comment-id | The comment ID | number | ✔ | v1 |
-| body | Update the content of comment | string | ✖ | v1 |
-| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
-| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| comment-id | The comment ID | number | ✔ |
+| body | Update the content of comment | string | ✖ |
+| update-mode | Update mode. Default `replace`, another `append` | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ |
- When `body` is not entered, it will remain as it is
- When `update-mode` is `append`, additional operations will be performed. Anything other than `append` will be replaced. Only effective for `body`
@@ -417,7 +417,7 @@ Update the specified issue according to the `issue-number`.
```yml
- name: Update issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -431,18 +431,18 @@ Update the specified issue according to the `issue-number`.
contents: '+1'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
-| issue-number | The number of issue | number | ✔ | v1 |
-| state | Modify the status of issue, optional value `open` `closed` | string | ✖ | v1 |
-| title | Modify the title of the issue | string | ✖ | v1 |
-| body | Modify the content of issue | string | ✖ | v1 |
-| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
-| labels | Replace the labels of issue | string | ✖ | v1.1 |
-| assignees | Replace the assignees of issue | string | ✖ | v1.1 |
-| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| issue-number | The number of issue | number | ✔ |
+| state | Modify the status of issue, optional value `open` `closed` | string | ✖ |
+| title | Modify the title of the issue | string | ✖ |
+| body | Modify the content of issue | string | ✖ |
+| update-mode | Update mode. Default `replace`, another `append` | string | ✖ |
+| labels | Replace the labels of issue | string | ✖ |
+| assignees | Replace the assignees of issue | string | ✖ |
+| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ |
- `state` defaults to `open`
- When the option is not filled, it will keep the original
@@ -465,7 +465,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
- uses: actions-cool/issues-helper@v1.3
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -475,13 +475,13 @@ jobs:
issue-contents: '+1, -1, eyes'
```
-| Param | Desc | Type | Required | Version |
-| -- | -- | -- | -- | -- |
-| actions | Action type | string | ✔ | v1.3 |
-| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1.3 |
-| body | Comment on the welcome content, no comment if you leave it blank | string | ✖ | v1.3 |
-| labels | Add labels to this issue | string | ✖ | v1.3 |
-| assignees | Add assignees to this issue | string | ✖ | v1.3 |
-| issue-contents | Add [reaction](/en-US/guide/ref#-reactions-type) to this issue| string | ✖ | v1.3 |
+| Param | Desc | Type | Required |
+| -- | -- | -- | -- |
+| actions | Action type | string | ✔ |
+| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
+| body | Comment on the welcome content, no comment if you leave it blank | string | ✖ |
+| labels | Add labels to this issue | string | ✖ |
+| assignees | Add assignees to this issue | string | ✖ |
+| issue-contents | Add [reaction](/en-US/guide/ref#-reactions-type) to this issue| string | ✖ |
- If these 4 options are not filled, no operation
\ No newline at end of file
diff --git a/docs/base.md b/docs/base.md
index 32b1faf..8812b5b 100644
--- a/docs/base.md
+++ b/docs/base.md
@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -30,18 +30,18 @@ jobs:
assignees: 'xxx' or 'xx1,xx2'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ |
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改
- [on 参考](/guide/ref#-github-相关文档)
- `${{ github.event.issue.number }}` 表示当前 issue,[更多参考](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
-- `assignees` 支持多个,需用逗号隔开。注意设置多个,需使用v1.1以上版本
+- `assignees` 支持多个,需用逗号隔开
## `add-labels`
@@ -60,7 +60,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -68,14 +68,14 @@ jobs:
labels: 'bug' or 'bug1,bug2'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| labels | 新增的 labels。当不填或者为空字符时,不新增 | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| labels | 新增的 labels。当不填或者为空字符时,不新增 | string | ✖ |
-- `labels` 支持多个,需用逗号隔开。注意设置多个,需使用v1.1以上版本
+- `labels` 支持多个,需用逗号隔开
## `close-issue`
@@ -83,7 +83,7 @@ jobs:
```yml
- name: Close issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -91,11 +91,11 @@ jobs:
body: 'This is auto closed.'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
## `create-comment`
@@ -114,7 +114,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -126,19 +126,19 @@ jobs:
contents: '+1' or '+1,heart'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| body | 新增评论的内容 | string | ✖ | v1 |
-| contents | 为新增评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| body | 新增评论的内容 | string | ✖ |
+| contents | 为新增评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
- `body` 默认为:`Currently at ${owner}/${repo}. And this is default comment.`
- 其中 `${owner}/${repo}` 表示当前仓库
- 返回 `comment-id`,可用于之后操作。[用法参考](/guide/ref#-outputs-使用)
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
-- `contents` 支持多个,需用逗号隔开。注意设置多个,需使用v1.1以上版本
+- `contents` 支持多个,需用逗号隔开
## `create-issue`
@@ -156,7 +156,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -167,15 +167,15 @@ jobs:
contents: '+1'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| title | 新增 issue 的标题 | string | ✖ | v1 |
-| body | 新增 issue 的内容 | string | ✖ | v1 |
-| labels | 为新增 issue 添加 labels | string | ✖ | v1.1 |
-| assignees | 为新增 issue 添加 assignees | string | ✖ | v1.1 |
-| contents | 为新增 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| title | 新增 issue 的标题 | string | ✖ |
+| body | 新增 issue 的内容 | string | ✖ |
+| labels | 为新增 issue 添加 labels | string | ✖ |
+| assignees | 为新增 issue 添加 assignees | string | ✖ |
+| contents | 为新增 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
- `title` 默认为:`Default Title`
- 返回 `issue-number`,[用法参考](/guide/ref#-outputs-使用)
@@ -186,18 +186,18 @@ jobs:
```yml
- name: Delete comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| comment-id | 指定的 comment | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| comment-id | 指定的 comment | number | ✔ |
## `lock-issue`
@@ -216,18 +216,18 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
## `mark-duplicate`
@@ -245,21 +245,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
- uses: actions-cool/issues-helper@v1.5
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.5 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1.5 |
-| duplicate-command | 可设置简洁命令,如:`/d` | string | ✖ | v1.6 |
-| duplicate-labels | 为该 issue 额外增加 labels | string | ✖ | v1.5 |
-| labels | 替换该 issue 的 labels | string | ✖ | v1.5 |
-| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.5 |
-| close-issue | 是否同时关闭该 issue | string | ✖ | v1.6 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| duplicate-command | 可设置简洁命令,如:`/d` | string | ✖ |
+| duplicate-labels | 为该 issue 额外增加 labels | string | ✖ |
+| labels | 替换该 issue 的 labels | string | ✖ |
+| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
+| close-issue | 是否同时关闭该 issue | string | ✖ |
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`
- `close-issue`:`true` 或 `'true'` 均可生效
@@ -276,18 +276,18 @@ jobs:
```yml
- name: Open issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
## `remove-assignees`
@@ -295,7 +295,7 @@ jobs:
```yml
- name: Remove assignees
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -303,12 +303,12 @@ jobs:
assignees: 'xx'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ |
## `remove-labels`
@@ -316,7 +316,7 @@ jobs:
```yml
- name: Remove labels
- uses: actions-cool/issues-helper@v1.2
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -324,12 +324,12 @@ jobs:
labels: 'xx'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.2 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1.2 |
-| issue-number | 指定的 issue | number | ✔ | v1.2 |
-| labels | 移除的 labels。当为空字符时,不进行移除 | string | ✔ | v1.2 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| labels | 移除的 labels。当为空字符时,不进行移除 | string | ✔ |
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
@@ -339,7 +339,7 @@ jobs:
```yml
- name: Set labels
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -347,12 +347,12 @@ jobs:
labels: 'xx'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| labels | labels 设置。当空字符时,会移除所有 | string | ✔ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| labels | labels 设置。当空字符时,会移除所有 | string | ✔ |
## `unlock-issue`
@@ -360,18 +360,18 @@ jobs:
```yml
- name: Unlock issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
## `update-comment`
@@ -391,7 +391,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -399,14 +399,14 @@ jobs:
contents: 'eyes'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| comment-id | 指定的 comment | number | ✔ | v1 |
-| body | 更新 comment 的内容 | string | ✖ | v1 |
-| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
-| contents | 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| comment-id | 指定的 comment | number | ✔ |
+| body | 更新 comment 的内容 | string | ✖ |
+| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ |
+| contents | 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
- `body` 不填时,会保持原有
- `update-mode` 为 `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
@@ -417,7 +417,7 @@ jobs:
```yml
- name: Update issue
- uses: actions-cool/issues-helper@v1
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -431,18 +431,18 @@ jobs:
contents: '+1'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
-| issue-number | 指定的 issue | number | ✔ | v1 |
-| state | 修改 issue 的状态,可选值 `open` `closed` | string | ✖ | v1 |
-| title | 修改 issue 的标题 | string | ✖ | v1 |
-| body | 修改 issue 的内容 | string | ✖ | v1 |
-| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
-| labels | 替换 issue 的 labels | string | ✖ | v1.1 |
-| assignees | 替换 issue 的 assignees | string | ✖ | v1.1 |
-| contents | 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| issue-number | 指定的 issue | number | ✔ |
+| state | 修改 issue 的状态,可选值 `open` `closed` | string | ✖ |
+| title | 修改 issue 的标题 | string | ✖ |
+| body | 修改 issue 的内容 | string | ✖ |
+| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ |
+| labels | 替换 issue 的 labels | string | ✖ |
+| assignees | 替换 issue 的 assignees | string | ✖ |
+| contents | 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
- `state` 默认为 `open`
- 当可选项不填时,会保持原有
@@ -464,7 +464,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
- uses: actions-cool/issues-helper@v1.3
+ uses: actions-cool/issues-helper@v1.7
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -474,13 +474,13 @@ jobs:
issue-contents: '+1, -1, eyes'
```
-| 参数 | 描述 | 类型 | 必填 | 版本 |
-| -- | -- | -- | -- | -- |
-| actions | 操作类型 | string | ✔ | v1.3 |
-| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1.3 |
-| body | 评论欢迎的内容,不填则不评论 | string | ✖ | v1.3 |
-| labels | 为该 issue 增加 labels | string | ✖ | v1.3 |
-| assignees | 为该 issue 增加 assignees | string | ✖ | v1.3 |
-| issue-contents | 为该 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.3 |
+| 参数 | 描述 | 类型 | 必填 |
+| -- | -- | -- | -- |
+| actions | 操作类型 | string | ✔ |
+| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
+| body | 评论欢迎的内容,不填则不评论 | string | ✖ |
+| labels | 为该 issue 增加 labels | string | ✖ |
+| assignees | 为该 issue 增加 assignees | string | ✖ |
+| issue-contents | 为该 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
- 若这 4 个可选项都不填,则无操作
\ No newline at end of file
diff --git a/docs/changelog.en-US.md b/docs/changelog.en-US.md
index ed588cb..9b7962b 100644
--- a/docs/changelog.en-US.md
+++ b/docs/changelog.en-US.md
@@ -9,7 +9,6 @@ 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
- - 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)
diff --git a/docs/changelog.md b/docs/changelog.md
index 29857fe..009c3d1 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -9,7 +9,6 @@ toc: menu
- v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
- - API 中参数需使用其中最大及以上版本
- 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
diff --git a/docs/index.en-US.md b/docs/index.en-US.md
index 1fa5f2b..86face6 100644
--- a/docs/index.en-US.md
+++ b/docs/index.en-US.md
@@ -51,7 +51,7 @@ jobs:
## 💖 Who is using?
-
+
## ⚡ Feedback
diff --git a/docs/index.md b/docs/index.md
index 3f74e01..7250c95 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -51,7 +51,7 @@ jobs:
## 💖 谁在使用?
-
+
## ⚡ 反馈
diff --git a/package.json b/package.json
index 35fe6d4..472d8fb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "issue-helper",
- "version": "1.6.0",
+ "version": "1.7.0",
"private": true,
"description": "Some operations on issue.",
"main": "src/main.js",
@@ -11,7 +11,8 @@
"docs:deploy": "gh-pages -d docs-dist",
"deploy": "npm run docs:build && npm run docs:deploy",
"package": "ncc build src/main.js -o dist",
- "update": "node ./script/update-user.js"
+ "update": "node ./script/update-user.js",
+ "main": "node ./src/main.js"
},
"author": "xrkffgg",
"license": "MIT",
diff --git a/src/advanced.js b/src/advanced.js
deleted file mode 100644
index a47624c..0000000
--- a/src/advanced.js
+++ /dev/null
@@ -1,228 +0,0 @@
-require('dotenv').config();
-const core = require("@actions/core");
-const { Octokit } = require('@octokit/rest');
-
-var dayjs = require('dayjs');
-var utc = require('dayjs/plugin/utc');
-dayjs.extend(utc);
-var isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
-dayjs.extend(isSameOrBefore);
-
-const {
- doAddLabels,
- doCloseIssue,
- doCreateComment,
- doLockIssue
-} = require('./base.js');
-
-const { dealInput, matchKeyword } = require('./util.js');
-
-const token = core.getInput('token');
-const octokit = new Octokit({ auth: `token ${token}` });
-
-let direction = core.getInput("direction");
-direction = direction === 'desc' ? 'desc' : 'asc';
-
-const commentAuth = core.getInput("comment-auth");
-const bodyIncludes = core.getInput('body-includes');
-const titleIncludes = core.getInput('title-includes');
-const assigneeIncludes = core.getInput('assignee-includes');
-
-const issueCreator = core.getInput("issue-creator");
-const issueAssignee = core.getInput('issue-assignee');
-const issueMentioned = core.getInput('issue-mentioned');
-
-let issueState = core.getInput("issue-state") || 'all';
-
-if (issueState != 'open' && issueState != 'closed') {
- issueState = 'all';
-}
-
-const inactiveDay = core.getInput("inactive-day");
-const inactiveLabel = core.getInput("inactive-label") || 'inactive';
-
-async function doCheckInactive (owner, repo, labels) {
- const issues = await doQueryIssues(owner, repo, labels, issueState);
-
- if (issues.length) {
- for (let i = 0; i < issues.length; i++) {
- if (!JSON.stringify(issues[i].labels).includes(inactiveLabel)) {
- await doAddLabels(owner, repo, issues[i].number, inactiveLabel);
- if (core.getInput("body")) {
- await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
- }
- } else {
- core.info(`Actions: [add-inactive] issue ${issues[i].number} has label!`);
- }
- }
- } else {
- core.info(`Actions: [query-issues] empty!`);
- }
-};
-
-/**
- * 检查 issue 是否满足条件,满足返回 true
- * 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
- * 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
- */
-async function doCheckIssue (owner, repo, issueNumber) {
- var checkResult = true;
- const issue = await octokit.issues.get({
- owner,
- repo,
- issue_number: issueNumber
- });
-
- if (!!checkResult && assigneeIncludes) {
- let assigneesCheck = dealInput(assigneeIncludes);
- let checkAssignee = false;
- issue.data.assignees.forEach(it => {
- if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) {
- checkResult = true;
- checkAssignee = true;
- }
- })
- !checkAssignee ? checkResult = false : null;
- }
-
- if (!!checkResult && titleIncludes) {
- const titleArr = titleIncludes.split('/');
- const keyword1 = dealInput(titleArr[0]);
- const keyword2 = dealInput(titleArr[1]);
- checkResult =
- keyword2.length ?
- matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) :
- matchKeyword(issue.data.title, keyword1);
- }
-
- if (!!checkResult && bodyIncludes) {
- const bodyArr = bodyIncludes.split('/');
- const keyword1 = dealInput(bodyArr[0]);
- const keyword2 = dealInput(bodyArr[1]);
- checkResult =
- keyword2.length ?
- matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) :
- matchKeyword(issue.data.body, keyword1);
- }
- core.info(`Actions: [check-issue][${!!checkResult}] success!`);
- core.setOutput("check-result", !!checkResult);
-};
-
-async function doCloseIssues (owner, repo, labels) {
- const issues = await doQueryIssues(owner, repo, labels, 'open');
-
- if (issues.length) {
- for (let i = 0; i < issues.length; i++) {
- await doCloseIssue(owner, repo, issues[i].number);
- if (core.getInput("body")) {
- await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
- }
- }
- } else {
- core.info(`Actions: [query-issues] empty!`);
- }
-};
-
-async function doFindComments (owner, repo, issueNumber) {
- const res = await octokit.issues.listComments({
- owner,
- repo,
- issue_number: issueNumber
- });
- core.info(`Actions: [find-comments][${issueNumber}] success!`);
- let comments = [];
- res.data.forEach(item => {
- const a = commentAuth ? item.user.login === commentAuth : true;
- const b = bodyIncludes ? item.body.includes(bodyIncludes) : true;
- if (a && b) {
- comments.push({
- id: item.id,
- auth: item.user.login,
- body: item.body,
- created: item.created_at,
- updated: item.updated_at
- })
- if (direction === 'desc') {
- comments.reverse();
- }
- }
- })
- core.setOutput("comments", comments);
-};
-
-async function doLockIssues (owner, repo, labels) {
- const issues = await doQueryIssues(owner, repo, labels, issueState);
-
- if (issues.length) {
- for (let i = 0; i < issues.length; i++) {
- await doLockIssue(owner, repo, issues[i].number);
- if (core.getInput("body")) {
- await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
- }
- }
- } else {
- core.info(`Actions: [query-issues] empty!`);
- }
-};
-
-async function doQueryIssues (owner, repo, labels, state, creator) {
- let params = {
- owner,
- repo,
- state,
- };
-
- issueCreator ? params.creator = issueCreator : null;
- issueAssignee ? params.assignee = issueAssignee : null;
- issueMentioned ? params.mentioned = issueMentioned : null;
-
- if (labels) {
- params.labels = labels;
- }
-
- if (creator) {
- params.creator = creator;
- }
-
- const res = await octokit.issues.listForRepo(params);
- let issues = [];
- 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);
- }
- }
- })
- core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`);
- }
-
- return issues;
-};
-
-module.exports = {
- doCheckInactive,
- doCheckIssue,
- doCloseIssues,
- doFindComments,
- doLockIssues,
-
- // tool
- doQueryIssues,
-};
diff --git a/src/base.js b/src/base.js
deleted file mode 100644
index d57701d..0000000
--- a/src/base.js
+++ /dev/null
@@ -1,412 +0,0 @@
-require('dotenv').config();
-const core = require("@actions/core");
-const github = require("@actions/github");
-const { Octokit } = require('@octokit/rest');
-
-const { doQueryIssues } = require('./advanced.js');
-
-const ALLREACTIONS = [
- "+1",
- "-1",
- "laugh",
- "confused",
- "heart",
- "hooray",
- "rocket",
- "eyes",
-];
-
-const { dealInput, testDuplicate } = require('./util.js');
-
-const token = core.getInput('token');
-const octokit = new Octokit({ auth: `token ${token}` });
-
-const contents = core.getInput("contents");
-const issueContents = core.getInput("issue-contents");
-
-const context = github.context;
-
-async function doAddAssignees (owner, repo, issueNumber, assignees) {
- await octokit.issues.addAssignees({
- owner,
- repo,
- issue_number: issueNumber,
- assignees: dealInput(assignees)
- });
- core.info(`Actions: [add-assignees][${assignees}] success!`);
-};
-
-async function doAddLabels (owner, repo, issueNumber, labels) {
- await octokit.issues.addLabels({
- owner,
- repo,
- issue_number: issueNumber,
- labels: dealInput(labels)
- });
- core.info(`Actions: [add-labels][${labels}] success!`);
-};
-
-async function doCloseIssue (owner, repo, issueNumber) {
- await octokit.issues.update({
- owner,
- repo,
- issue_number: issueNumber,
- state: 'closed'
- });
- core.info(`Actions: [close-issue][${issueNumber}] success!`);
-};
-
-async function doCreateComment (owner, repo, issueNumber, body) {
- const { data } = await octokit.issues.createComment({
- owner,
- repo,
- issue_number: issueNumber,
- body
- });
- core.info(`Actions: [create-comment][${body}] success!`);
- core.setOutput("comment-id", data.id);
-
- if (contents) {
- await doCreateCommentContent(owner, repo, data.id, dealInput(contents));
- }
-};
-
-async function doCreateCommentContent(owner, repo, commentId, contents) {
- if (contents.length) {
- contents.forEach(async item => {
- if (testContent(item)) {
- await octokit.reactions.createForIssueComment({
- owner,
- repo,
- comment_id: commentId,
- content: item
- });
- core.info(`Actions: [create-reactions][${item}] success!`);
- }
- })
- }
-};
-
-async function doCreateIssue (owner, repo, title, body, labels, assignees) {
- let params = {
- owner,
- repo,
- title,
- body,
- labels: dealInput(labels),
- assignees: dealInput(assignees),
- };
-
- const { data } = await octokit.issues.create(params);
- core.info(`Actions: [create-issue][${title}] success!`);
- core.setOutput("issue-number", data.number);
-
- if (contents) {
- await doCreateIssueContent(owner, repo, data.number, dealInput(contents));
- }
-};
-
-async function doCreateIssueContent(owner, repo, issueNumber, contents) {
- if (contents.length) {
- contents.forEach(async item => {
- if (testContent(item)) {
- await octokit.reactions.createForIssue({
- owner,
- repo,
- issue_number: issueNumber,
- content: item
- });
- core.info(`Actions: [create-reactions][${item}] success!`);
- }
- })
- }
-};
-
-async function doDeleteComment (owner, repo, commentId) {
- await octokit.issues.deleteComment({
- owner,
- repo,
- comment_id: commentId
- });
- core.info(`Actions: [delete-comment][${commentId}] success!`);
-};
-
-async function doLockIssue (owner, repo, issueNumber) {
- await octokit.issues.lock({
- owner,
- repo,
- issue_number: issueNumber,
- });
- core.info(`Actions: [lock-issue][${issueNumber}] success!`);
-};
-
-async function doMarkDuplicate (owner, repo, labels) {
- if (context.eventName != 'issue_comment') {
- core.info(`This actions only support on 'issue_comment'!`);
- return false;
- }
- if (context.payload.action != 'created') {
- core.info(`This actions only support on 'issue_comment' created!`);
- return false;
- }
-
- const duplicateCommand = core.getInput("duplicate-command");
- const duplicateLabels = core.getInput("duplicate-labels");
- const closeIssue = core.getInput("close-issue");
-
- const commentId = context.payload.comment.id;
- const commentBody = context.payload.comment.body;
- const issueNumber = context.payload.issue.number;
-
- const ifCommandInput = !!duplicateCommand;
-
- if ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody)) {
- if (ifCommandInput) {
- const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
- await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
- } else if (contents) {
- await doCreateCommentContent(owner, repo, commentId, dealInput(contents));
- }
- if (duplicateLabels) {
- await doAddLabels(owner, repo, issueNumber, duplicateLabels);
- }
- if (labels) {
- await doSetLabels(owner, repo, issueNumber, labels);
- }
- if (closeIssue == 'true') {
- await doCloseIssue(owner, repo, issueNumber);
- }
- } else {
- core.info(`This comment body should start whith 'duplicate-command'`);
- }
-};
-
-async function doOpenIssue (owner, repo, issueNumber) {
- await octokit.issues.update({
- owner,
- repo,
- issue_number: issueNumber,
- state: 'open'
- });
- core.info(`Actions: [open-issue][${issueNumber}] success!`);
-};
-
-async function doRemoveAssignees (owner, repo, issueNumber, assignees) {
- await octokit.issues.removeAssignees({
- owner,
- repo,
- issue_number: issueNumber,
- assignees: dealInput(assignees),
- });
- core.info(`Actions: [remove-assignees][${assignees}] success!`);
-};
-
-async function doRemoveLabels (owner, repo, issueNumber, labels) {
- const issue = await octokit.issues.get({
- owner,
- repo,
- issue_number: issueNumber
- });
- const dealLabels = dealInput(labels);
- let addLables = [];
- if (dealLabels.length) {
- issue.data.labels.forEach(item => {
- !dealLabels.includes(item.name) ? addLables.push(item.name) : '';
- })
- await octokit.issues.setLabels({
- owner,
- repo,
- issue_number: issueNumber,
- labels: addLables
- });
- core.info(`Actions: [remove-labels][${labels}] success!`);
- }
-};
-
-async function doSetLabels (owner, repo, issueNumber, labels) {
- await octokit.issues.setLabels({
- owner,
- repo,
- issue_number: issueNumber,
- labels: dealInput(labels)
- });
- core.info(`Actions: [set-labels][${labels}] success!`);
-};
-
-async function doUnlockIssue (owner, repo, issueNumber) {
- await octokit.issues.unlock({
- owner,
- repo,
- issue_number: issueNumber,
- });
- core.info(`Actions: [unlock-issue][${issueNumber}] success!`);
-};
-
-async function doUpdateComment (
- owner,
- repo,
- commentId,
- body,
- updateMode,
- ifUpdateBody,
-) {
- const comment = await octokit.issues.getComment({
- owner,
- repo,
- comment_id: commentId
- })
- const comment_body = comment.data.body;
-
- let params = {
- owner,
- repo,
- comment_id: commentId
- };
-
- if (core.getInput("body") || ifUpdateBody) {
- if (updateMode === 'append') {
- params.body = `${comment_body}\n${body}`;
- } else {
- params.body = body;
- }
-
- await octokit.issues.updateComment(params);
- core.info(`Actions: [update-comment][${commentId}] success!`);
- }
-
- if (contents) {
- await doCreateCommentContent(owner, repo, commentId, dealInput(contents));
- }
-};
-
-async function doUpdateIssue (
- owner,
- repo,
- issueNumber,
- state,
- title,
- body,
- updateMode,
- assignees,
- labels
-) {
- const issue = await octokit.issues.get({
- owner,
- repo,
- issue_number: issueNumber
- })
- const issue_body = issue.data.body;
- const issue_title = issue.data.title;
-
- let issue_labels = [];
- if (issue.data.labels.length > 0) {
- issue.data.labels.forEach(it =>{
- issue_labels.push(it.name);
- });
- }
-
- let issue_assignees = [];
- if (issue.data.assignees.length > 0) {
- issue.data.assignees.forEach(it =>{
- issue_assignees.push(it.login);
- });
- }
-
- let params = {
- owner,
- repo,
- issue_number: issueNumber,
- state
- };
-
- params.title = core.getInput("title") ? title : issue_title;
-
- let next_body;
- if (core.getInput("body")) {
- if (updateMode === 'append') {
- next_body = `${issue_body}\n${body}`;
- } else {
- next_body = body;
- }
- } else {
- next_body = issue_body;
- }
- params.body = next_body;
-
- params.labels = labels ? dealInput(labels) : issue_labels;
- params.assignees = assignees ? dealInput(assignees) : issue_assignees;
-
- await octokit.issues.update(params);
- core.info(`Actions: [update-issue][${issueNumber}] success!`);
-
- if (contents) {
- await doCreateIssueContent(owner, repo, issueNumber, contents);
- }
-};
-
-async function doWelcome (owner, repo, assignees, labels, body) {
- const context = github.context;
- const isIssue = !!context.payload.issue;
- if (!isIssue) {
- core.setFailed("The event that triggered this action must be a issue. Error!");
- } else {
- const auth = context.payload.sender.login;
- core.info(`Actions: [welcome: auth=][${auth}]`);
- const issueNumber = context.issue.number;
- const creator = 'zoo-js-bot';
- const issues = await doQueryIssues(owner, repo, false, 'all', creator);
- if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) {
- if (core.getInput("body")) {
- await doCreateComment(owner, repo, issueNumber, body);
- } else {
- core.info(`Actions: [welcome] no body!`);
- }
-
- if (assignees) {
- await doAddAssignees(owner, repo, issueNumber, assignees);
- }
-
- if (labels) {
- await doAddLabels(owner, repo, issueNumber, labels);
- }
-
- if (issueContents) {
- await doCreateIssueContent(owner, repo, issueNumber, dealInput(issueContents));
- }
- } else {
- core.info(`Actions: [welcome][${auth}] is not first time!`);
- }
- }
-};
-
-// tool
-function testContent(con) {
- if (ALLREACTIONS.includes(con)) {
- return true;
- } else {
- core.setFailed("This actions not supported!");
- return false;
- }
-};
-
-// exports
-module.exports = {
- doAddAssignees,
- doAddLabels,
- doCloseIssue,
- doCreateComment,
- doCreateCommentContent,
- doCreateIssue,
- doCreateIssueContent,
- doDeleteComment,
- doMarkDuplicate,
- doLockIssue,
- doOpenIssue,
- doRemoveAssignees,
- doRemoveLabels,
- doSetLabels,
- doUnlockIssue,
- doUpdateComment,
- doUpdateIssue,
- doWelcome,
-};
diff --git a/src/do.js b/src/do.js
new file mode 100644
index 0000000..4c8c7ba
--- /dev/null
+++ b/src/do.js
@@ -0,0 +1,787 @@
+require('dotenv').config();
+const core = require("@actions/core");
+const github = require("@actions/github");
+const { Octokit } = require('@octokit/rest');
+
+var dayjs = require('dayjs');
+var utc = require('dayjs/plugin/utc');
+dayjs.extend(utc);
+var isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
+dayjs.extend(isSameOrBefore);
+
+const ALLREACTIONS = [
+ "+1",
+ "-1",
+ "laugh",
+ "confused",
+ "heart",
+ "hooray",
+ "rocket",
+ "eyes",
+];
+
+const {
+ dealInput,
+ matchKeyword,
+ testDuplicate,
+ getPreMonth
+} = require('./util.js');
+
+const token = core.getInput('token');
+
+const octokit = new Octokit({ auth: `token ${token}` });
+
+const contents = core.getInput("contents");
+const issueContents = core.getInput("issue-contents");
+
+// advanced
+let direction = core.getInput("direction");
+direction = direction === 'desc' ? 'desc' : 'asc';
+const commentAuth = core.getInput("comment-auth");
+const bodyIncludes = core.getInput('body-includes');
+const titleIncludes = core.getInput('title-includes');
+const assigneeIncludes = core.getInput('assignee-includes');
+
+const issueCreator = core.getInput("issue-creator");
+const issueAssignee = core.getInput('issue-assignee');
+const issueMentioned = core.getInput('issue-mentioned');
+
+let issueState = core.getInput("issue-state") || 'open';
+
+if (issueState != 'all' && issueState != 'closed') {
+ issueState = 'open';
+}
+
+const inactiveDay = core.getInput("inactive-day");
+const inactiveLabel = core.getInput("inactive-label") || 'inactive';
+const perPage = 100;
+
+// context
+const context = github.context;
+
+// base
+async function doAddAssignees (owner, repo, issueNumber, assignees) {
+ await octokit.issues.addAssignees({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ assignees: dealInput(assignees)
+ });
+ core.info(`Actions: [add-assignees][${assignees}] success!`);
+};
+
+async function doAddLabels (owner, repo, issueNumber, labels) {
+ await octokit.issues.addLabels({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ labels: dealInput(labels)
+ });
+ core.info(`Actions: [add-labels][${labels}] success!`);
+};
+
+async function doCloseIssue (owner, repo, issueNumber) {
+ await octokit.issues.update({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ state: 'closed'
+ });
+ core.info(`Actions: [close-issue][${issueNumber}] success!`);
+};
+
+async function doCreateComment (owner, repo, issueNumber, body) {
+ const { data } = await octokit.issues.createComment({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ body
+ });
+ core.info(`Actions: [create-comment][${body}] success!`);
+ core.setOutput("comment-id", data.id);
+
+ if (contents) {
+ await doCreateCommentContent(owner, repo, data.id, dealInput(contents));
+ }
+};
+
+async function doCreateCommentContent(owner, repo, commentId, contents) {
+ if (contents.length) {
+ contents.forEach(async item => {
+ if (testContent(item)) {
+ await octokit.reactions.createForIssueComment({
+ owner,
+ repo,
+ comment_id: commentId,
+ content: item
+ });
+ core.info(`Actions: [create-reactions][${item}] success!`);
+ }
+ })
+ }
+};
+
+async function doCreateIssue (owner, repo, title, body, labels, assignees) {
+ let params = {
+ owner,
+ repo,
+ title,
+ body,
+ labels: dealInput(labels),
+ assignees: dealInput(assignees),
+ };
+
+ const { data } = await octokit.issues.create(params);
+ core.info(`Actions: [create-issue][${title}] success!`);
+ core.setOutput("issue-number", data.number);
+
+ if (contents) {
+ await doCreateIssueContent(owner, repo, data.number, dealInput(contents));
+ }
+};
+
+async function doCreateIssueContent(owner, repo, issueNumber, contents) {
+ if (contents.length) {
+ contents.forEach(async item => {
+ if (testContent(item)) {
+ await octokit.reactions.createForIssue({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ content: item
+ });
+ core.info(`Actions: [create-reactions][${item}] success!`);
+ }
+ })
+ }
+};
+
+async function doDeleteComment (owner, repo, commentId) {
+ await octokit.issues.deleteComment({
+ owner,
+ repo,
+ comment_id: commentId
+ });
+ core.info(`Actions: [delete-comment][${commentId}] success!`);
+};
+
+async function doLockIssue (owner, repo, issueNumber) {
+ await octokit.issues.lock({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ });
+ core.info(`Actions: [lock-issue][${issueNumber}] success!`);
+};
+
+async function doMarkDuplicate (owner, repo, labels) {
+ if (context.eventName != 'issue_comment') {
+ core.info(`This actions only support on 'issue_comment'!`);
+ return false;
+ }
+ if (context.payload.action != 'created') {
+ core.info(`This actions only support on 'issue_comment' created!`);
+ return false;
+ }
+
+ const duplicateCommand = core.getInput("duplicate-command");
+ const duplicateLabels = core.getInput("duplicate-labels");
+ const closeIssue = core.getInput("close-issue");
+
+ const commentId = context.payload.comment.id;
+ const commentBody = context.payload.comment.body;
+ const issueNumber = context.payload.issue.number;
+
+ const ifCommandInput = !!duplicateCommand;
+
+ if ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody)) {
+ if (ifCommandInput) {
+ const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
+ await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
+ } else if (contents) {
+ await doCreateCommentContent(owner, repo, commentId, dealInput(contents));
+ }
+ if (duplicateLabels) {
+ await doAddLabels(owner, repo, issueNumber, duplicateLabels);
+ }
+ if (labels) {
+ await doSetLabels(owner, repo, issueNumber, labels);
+ }
+ if (closeIssue == 'true') {
+ await doCloseIssue(owner, repo, issueNumber);
+ }
+ } else {
+ core.info(`This comment body should start whith 'duplicate-command'`);
+ }
+};
+
+async function doOpenIssue (owner, repo, issueNumber) {
+ await octokit.issues.update({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ state: 'open'
+ });
+ core.info(`Actions: [open-issue][${issueNumber}] success!`);
+};
+
+async function doRemoveAssignees (owner, repo, issueNumber, assignees) {
+ await octokit.issues.removeAssignees({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ assignees: dealInput(assignees),
+ });
+ core.info(`Actions: [remove-assignees][${assignees}] success!`);
+};
+
+async function doRemoveLabels (owner, repo, issueNumber, labels) {
+ const issue = await octokit.issues.get({
+ owner,
+ repo,
+ issue_number: issueNumber
+ });
+ const dealLabels = dealInput(labels);
+ let addLables = [];
+ if (dealLabels.length) {
+ issue.data.labels.forEach(item => {
+ !dealLabels.includes(item.name) ? addLables.push(item.name) : '';
+ })
+ await octokit.issues.setLabels({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ labels: addLables
+ });
+ core.info(`Actions: [remove-labels][${labels}] success!`);
+ }
+};
+
+async function doSetLabels (owner, repo, issueNumber, labels) {
+ await octokit.issues.setLabels({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ labels: dealInput(labels)
+ });
+ core.info(`Actions: [set-labels][${labels}] success!`);
+};
+
+async function doUnlockIssue (owner, repo, issueNumber) {
+ await octokit.issues.unlock({
+ owner,
+ repo,
+ issue_number: issueNumber,
+ });
+ core.info(`Actions: [unlock-issue][${issueNumber}] success!`);
+};
+
+async function doUpdateComment (
+ owner,
+ repo,
+ commentId,
+ body,
+ updateMode,
+ ifUpdateBody,
+) {
+ const comment = await octokit.issues.getComment({
+ owner,
+ repo,
+ comment_id: commentId
+ })
+ const comment_body = comment.data.body;
+
+ let params = {
+ owner,
+ repo,
+ comment_id: commentId
+ };
+
+ if (core.getInput("body") || ifUpdateBody) {
+ if (updateMode === 'append') {
+ params.body = `${comment_body}\n${body}`;
+ } else {
+ params.body = body;
+ }
+
+ await octokit.issues.updateComment(params);
+ core.info(`Actions: [update-comment][${commentId}] success!`);
+ }
+
+ if (contents) {
+ await doCreateCommentContent(owner, repo, commentId, dealInput(contents));
+ }
+};
+
+async function doUpdateIssue (
+ owner,
+ repo,
+ issueNumber,
+ state,
+ title,
+ body,
+ updateMode,
+ assignees,
+ labels
+) {
+ const issue = await octokit.issues.get({
+ owner,
+ repo,
+ issue_number: issueNumber
+ })
+ const issue_body = issue.data.body;
+ const issue_title = issue.data.title;
+
+ let issue_labels = [];
+ if (issue.data.labels.length > 0) {
+ issue.data.labels.forEach(it =>{
+ issue_labels.push(it.name);
+ });
+ }
+
+ let issue_assignees = [];
+ if (issue.data.assignees.length > 0) {
+ issue.data.assignees.forEach(it =>{
+ issue_assignees.push(it.login);
+ });
+ }
+
+ let params = {
+ owner,
+ repo,
+ issue_number: issueNumber,
+ state
+ };
+
+ params.title = core.getInput("title") ? title : issue_title;
+
+ let next_body;
+ if (core.getInput("body")) {
+ if (updateMode === 'append') {
+ next_body = `${issue_body}\n${body}`;
+ } else {
+ next_body = body;
+ }
+ } else {
+ next_body = issue_body;
+ }
+ params.body = next_body;
+
+ params.labels = labels ? dealInput(labels) : issue_labels;
+ params.assignees = assignees ? dealInput(assignees) : issue_assignees;
+
+ await octokit.issues.update(params);
+ core.info(`Actions: [update-issue][${issueNumber}] success!`);
+
+ if (contents) {
+ await doCreateIssueContent(owner, repo, issueNumber, contents);
+ }
+};
+
+async function doWelcome (owner, repo, assignees, labels, body) {
+ const context = github.context;
+ const isIssue = !!context.payload.issue;
+ if (!isIssue) {
+ core.setFailed("The event that triggered this action must be a issue. Error!");
+ } else {
+ const auth = context.payload.sender.login;
+ core.info(`Actions: [welcome: auth=][${auth}]`);
+ const issueNumber = context.issue.number;
+ const issues = await doQueryIssues(owner, repo, false, 'all', auth);
+ if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) {
+ if (core.getInput("body")) {
+ await doCreateComment(owner, repo, issueNumber, body);
+ } else {
+ core.info(`Actions: [welcome] no body!`);
+ }
+
+ if (assignees) {
+ await doAddAssignees(owner, repo, issueNumber, assignees);
+ }
+
+ if (labels) {
+ await doAddLabels(owner, repo, issueNumber, labels);
+ }
+
+ if (issueContents) {
+ await doCreateIssueContent(owner, repo, issueNumber, dealInput(issueContents));
+ }
+ } else {
+ core.info(`Actions: [welcome][${auth}] is not first time!`);
+ }
+ }
+};
+
+// advanced
+async function doCheckInactive (owner, repo, labels) {
+ const issues = await doQueryIssues(owner, repo, labels, issueState);
+
+ if (issues.length) {
+ for (let i = 0; i < issues.length; i++) {
+ if (!JSON.stringify(issues[i].labels).includes(inactiveLabel)) {
+ await doAddLabels(owner, repo, issues[i].number, inactiveLabel);
+ if (core.getInput("body")) {
+ await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
+ }
+ } else {
+ core.info(`Actions: [add-inactive] issue ${issues[i].number} has label!`);
+ }
+ }
+ } else {
+ core.info(`Actions: [query-issues] empty!`);
+ }
+};
+
+/**
+ * 检查 issue 是否满足条件,满足返回 true
+ * 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
+ * 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
+ */
+async function doCheckIssue (owner, repo, issueNumber) {
+ var checkResult = true;
+ const issue = await octokit.issues.get({
+ owner,
+ repo,
+ issue_number: issueNumber
+ });
+
+ if (!!checkResult && assigneeIncludes) {
+ let assigneesCheck = dealInput(assigneeIncludes);
+ let checkAssignee = false;
+ issue.data.assignees.forEach(it => {
+ if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) {
+ checkResult = true;
+ checkAssignee = true;
+ }
+ })
+ !checkAssignee ? checkResult = false : null;
+ }
+
+ if (!!checkResult && titleIncludes) {
+ const titleArr = titleIncludes.split('/');
+ const keyword1 = dealInput(titleArr[0]);
+ const keyword2 = dealInput(titleArr[1]);
+ checkResult =
+ keyword2.length ?
+ matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) :
+ matchKeyword(issue.data.title, keyword1);
+ }
+
+ if (!!checkResult && bodyIncludes) {
+ const bodyArr = bodyIncludes.split('/');
+ const keyword1 = dealInput(bodyArr[0]);
+ const keyword2 = dealInput(bodyArr[1]);
+ checkResult =
+ keyword2.length ?
+ matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) :
+ matchKeyword(issue.data.body, keyword1);
+ }
+ core.info(`Actions: [check-issue][${!!checkResult}] success!`);
+ core.setOutput("check-result", !!checkResult);
+};
+
+async function doCloseIssues (owner, repo, labels) {
+ const issues = await doQueryIssues(owner, repo, labels, 'open');
+
+ if (issues.length) {
+ for (let i = 0; i < issues.length; i++) {
+ await doCloseIssue(owner, repo, issues[i].number);
+ if (core.getInput("body")) {
+ await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
+ }
+ }
+ } else {
+ core.info(`Actions: [query-issues] empty!`);
+ }
+};
+
+async function doFindComments (owner, repo, issueNumber) {
+ const res = await octokit.issues.listComments({
+ owner,
+ repo,
+ issue_number: issueNumber
+ });
+ core.info(`Actions: [find-comments][${issueNumber}] success!`);
+ let comments = [];
+ res.data.forEach(item => {
+ const a = commentAuth ? item.user.login === commentAuth : true;
+ const b = bodyIncludes ? item.body.includes(bodyIncludes) : true;
+ if (a && b) {
+ comments.push({
+ id: item.id,
+ auth: item.user.login,
+ body: item.body,
+ created: item.created_at,
+ updated: item.updated_at
+ })
+ if (direction === 'desc') {
+ comments.reverse();
+ }
+ }
+ })
+ core.setOutput("comments", comments);
+};
+
+async function doLockIssues (owner, repo, labels) {
+ const issues = await doQueryIssues(owner, repo, labels, issueState);
+
+ if (issues.length) {
+ for (let i = 0; i < issues.length; i++) {
+ await doLockIssue(owner, repo, issues[i].number);
+ if (core.getInput("body")) {
+ await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
+ }
+ }
+ } else {
+ core.info(`Actions: [query-issues] empty!`);
+ }
+};
+
+async function doMonthStatistics (owner, repo, labels, assignees) {
+ const countLables = core.getInput("count-lables");
+ const countComments = core.getInput("count-comments");
+
+ const thisMonth = dayjs.utc().month() + 1;
+ const year = thisMonth == 1 ? dayjs.utc().year() - 1 : dayjs.utc().year();
+
+ const month = getPreMonth(thisMonth);
+ const showMonth = month < 10 ? `0${month}` : month;
+
+ let issues = await getIssuesInMonth(
+ owner,
+ repo,
+ thisMonth
+ );
+ if (issues.length == 0) {
+ core.info(`Actions: [query-issues-${month}] empty!`);
+ return false;
+ }
+ issues = issues.filter(i => {
+ return getCreatedMontn(i.created_at) == month
+ });
+ let total = issues.length;
+ let totalIssues = [...issues];
+ let openTotal = 0;
+ let openIssuesNumber = [];
+ let closeTotal = 0;
+ let closeIssuesNumber = [];
+ let labelsTotals = [];
+ const title = `[${owner}/${repo}] Month Statistics: ${year}-${showMonth}`;
+ for (let i = 0; i < issues.length; i++) {
+ if (issues[i].state == 'closed') {
+ closeTotal += 1;
+ closeIssuesNumber.push(issues[i].number);
+ } else if (issues[i].state == 'open') {
+ openTotal += 1;
+ openIssuesNumber.push(issues[i].number);
+ }
+ if (countLables && issues[i].labels) {
+ issues[i].labels.forEach(l => {
+ if (l.name in labelsTotals) {
+ labelsTotals[l.name] += 1;
+ } else {
+ labelsTotals[l.name] = 1;
+ }
+ })
+ }
+ }
+ let now = dayjs().utc().format('YYYY-MM-DD HH:mm:ss');
+ let body = `
+- Created time: ${now}
+
+- Time base: UTC +0
+`;
+ let totalShow = `
+### Count
+
+| Total | Open | Closed |
+| -- | -- | -- |
+| ${total} | ${openTotal} | ${closeTotal} |
+
+`;
+
+ body += totalShow;
+
+ if (countLables == 'true') {
+ let labelsArr = [];
+ for (var lab in labelsTotals) {
+ labelsArr.push({
+ labelName: lab,
+ number: labelsTotals[lab]
+ })
+ }
+ labelsArr.sort((a, b) => b.number - a.number);
+ let labelsTitle = `
+### Labels statistics
+
+
+
+Name |
+Number |
+
`
+ let labelsBody = '';
+ labelsArr.forEach(it => {
+ labelsBody += `${it.labelName} | ${it.number} |
`
+ })
+ body = body + labelsTitle + labelsBody + `
+
+`;
+ }
+
+ if (countComments == 'true') {
+ totalIssues.sort((a, b) => b.comments - a.comments);
+ const maxComments = totalIssues.slice(0, 3);
+ let commentTitle = `
+### Most commente
+
+
+
+# |
+Issue |
+Title |
+Number |
+State |
+
+`
+ let commentBody = '';
+ maxComments.forEach((it,ind) => {
+ commentBody += `
+${ind + 1} |
+${it.number} |
+${it.title} |
+${it.comments} |
+${it.state} |
`
+ })
+ body = body + commentTitle + commentBody + '
';
+ }
+
+ await doCreateIssue(owner, repo, title, body, labels, assignees);
+};
+
+
+// Tool
+async function doQueryIssues (owner, repo, labels, state, creator) {
+ let params = {
+ owner,
+ repo,
+ state,
+ };
+
+ issueCreator ? params.creator = issueCreator : null;
+ issueAssignee ? params.assignee = issueAssignee : null;
+ issueMentioned ? params.mentioned = issueMentioned : null;
+
+ if (labels) {
+ params.labels = labels;
+ }
+
+ if (creator) {
+ params.creator = creator;
+ }
+
+ const res = await getIssues(params);
+ let issues = [];
+ let issueNumbers = [];
+ if (res.length) {
+ res.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);
+ }
+ }
+ })
+ core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`);
+ }
+
+ return issues;
+};
+
+async function getIssues (params, page = 1) {
+ let { data: issues } = await octokit.issues.listForRepo({
+ ...params,
+ per_page: perPage,
+ page
+ });
+ if (issues.length >= perPage) {
+ issues = issues.concat(await getIssues(params, page + 1));
+ }
+ return issues;
+};
+
+async function getIssuesInMonth (owner, repo, thisMonth, page = 1) {
+ const month = getPreMonth(thisMonth);
+ let { data: issues } = await octokit.issues.listForRepo({
+ owner,
+ repo,
+ state: 'all',
+ per_page: perPage,
+ page
+ });
+ issues = issues.filter(i => {
+ return i.pull_request === undefined
+ });
+ if (issues.length && getCreatedMontn(issues[issues.length - 1].created_at) >= month) {
+ issues = issues.concat(await getIssuesInMonth(owner, repo, thisMonth, page + 1));
+ }
+ return issues;
+};
+
+// tool
+function testContent(con) {
+ if (ALLREACTIONS.includes(con)) {
+ return true;
+ } else {
+ core.setFailed("This actions not supported!");
+ return false;
+ }
+};
+
+function getCreatedMontn (d) {
+ return dayjs(d).utc().month() + 1;
+};
+
+// exports
+module.exports = {
+ // base
+ doAddAssignees,
+ doAddLabels,
+ doCloseIssue,
+ doCreateComment,
+ doCreateCommentContent,
+ doCreateIssue,
+ doCreateIssueContent,
+ doDeleteComment,
+ doMarkDuplicate,
+ doLockIssue,
+ doOpenIssue,
+ doRemoveAssignees,
+ doRemoveLabels,
+ doSetLabels,
+ doUnlockIssue,
+ doUpdateComment,
+ doUpdateIssue,
+ doWelcome,
+
+ // advanced
+ doCheckInactive,
+ doCheckIssue,
+ doCloseIssues,
+ doFindComments,
+ doLockIssues,
+ doMonthStatistics,
+};
diff --git a/src/main.js b/src/main.js
index 969c64b..926797a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -2,6 +2,7 @@ const core = require("@actions/core");
const github = require("@actions/github");
const {
+ // base
doAddAssignees,
doAddLabels,
doCloseIssue,
@@ -20,15 +21,15 @@ const {
doUpdateComment,
doUpdateIssue,
doWelcome,
-} = require('./base.js');
-const {
+ // advanced
doCheckInactive,
doCheckIssue,
doCloseIssues,
doFindComments,
doLockIssues,
-} = require('./advanced.js');
+ doMonthStatistics,
+} = require('./do.js');
const ALLACTIONS = [
// base
@@ -55,6 +56,7 @@ const ALLACTIONS = [
'close-issues',
'find-comments',
'lock-issues',
+ 'month-statistics',
];
async function main() {
@@ -207,6 +209,14 @@ async function main() {
labels
);
break;
+ case 'month-statistics':
+ await doMonthStatistics(
+ owner,
+ repo,
+ labels,
+ assignees
+ );
+ break;
// default
default:
break;
diff --git a/src/util.js b/src/util.js
index e90c4f3..2857297 100644
--- a/src/util.js
+++ b/src/util.js
@@ -28,8 +28,13 @@ function testDuplicate(body) {
}
};
+function getPreMonth (m) {
+ return m == 1 ? 12 : m -1;
+};
+
module.exports = {
dealInput,
+ getPreMonth,
matchKeyword,
testDuplicate,
};