Compare commits

..

16 Commits

Author SHA1 Message Date
xrkffgg
f743eedacb chore: add catch (#59)
* chore: add catch

* format
2021-02-03 09:28:14 +08:00
xrkffgg
65461c17ed docs: update v2.1.1 (#58) 2021-02-03 00:45:14 +08:00
xrkffgg
1efbf3d3cf fix: api request limit (#57) 2021-02-03 00:34:17 +08:00
xrkffgg
14e4762bf5 docs: up v2.1.0 2021-02-02 20:38:24 +08:00
xrkffgg
fd3eb6dbd3 feat: add create-label (#54)
* feat: add create-label

* add doc

* format

* add
2021-02-02 20:33:00 +08:00
xrkffgg
561193570f up 2021-02-02 20:32:37 +08:00
xrkffgg
f2288b2a14 add 2021-02-02 20:22:50 +08:00
xrkffgg
4281108d01 format 2021-02-02 20:22:38 +08:00
xrkffgg
1cc6f0b7ca add doc 2021-02-02 20:12:42 +08:00
xrkffgg
f6788d2b8e feat: add create-label 2021-02-02 17:55:54 +08:00
xrkffgg
8acd7991df docs: add token trigger note 2021-02-01 10:03:25 +08:00
xrkffgg
321da097ae Create gh-pages.yml 2021-01-28 15:25:47 +08:00
xrkffgg
13e635fb2c docs: up version faq 2021-01-27 11:25:01 +08:00
xrkffgg
ae8b2ad0bd docs: update version desc 2021-01-27 11:17:46 +08:00
xrkffgg
576d7c4cb8 docs: up version v2 (#52) 2021-01-26 23:17:43 +08:00
xrkffgg
b0e25793f1 refactor: add require-permission default (#51) 2021-01-26 22:59:37 +08:00
26 changed files with 451 additions and 205 deletions

17
.github/workflows/gh-pages.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: github pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm install
- run: npm run docs:build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs-dist

View File

@@ -2,3 +2,4 @@ dist/
lib/
docs-dist/
node_modules/
src/.umi/

View File

@@ -1,3 +1,21 @@
## v2.1.1
`2021.02.03`
- fix: api request limit. [#57](https://github.com/actions-cool/issues-helper/pull/57)
## v2.1.0
`2021.02.02`
- feat: add create-label. [#54](https://github.com/actions-cool/issues-helper/pull/54)
## v2.0.0
`2021.01.26`
- refactor: add require-permission default. [#51](https://github.com/actions-cool/issues-helper/pull/51)
## v1.12
> It will be the last version of 1.x

View File

@@ -6,8 +6,8 @@
[![](https://img.shields.io/badge/marketplace-issues--helper-red?style=flat-square)](https://github.com/marketplace/actions/issues-helper)
[![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases)
[![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases)
[![](https://img.shields.io/github/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers)
[![](https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square&color=%2308979c)](https://github.com/actions-cool/issues-helper/discussions)
[![](https://img.shields.io/github/license/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
@@ -56,6 +56,11 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
<div>material-ui</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/prettier/prettier">
<img src="https://github.com/prettier/prettier-logo/blob/master/images/prettier-icon-light.png?raw=true" width="46" />
<div>prettier</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/ant-design/pro-components">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
@@ -66,12 +71,12 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
<img src="https://avatars3.githubusercontent.com/u/9441414?s=200&v=4" width="46" />
<div>react-component</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/lijinke666/react-music-player">
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
<div>react-music-player</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/umijs/umi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
@@ -87,7 +92,6 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
<img src="https://avatars1.githubusercontent.com/u/70757173?s=200&v=4" width="46" />
<div>zoo</div>
</a></td>
<td align="center" width="180"></td>
</tr>
</table>
@@ -101,6 +105,7 @@ When the following list does not have the features you want, you can submit it i
- [`close-issue`](#close-issue)
- [`create-comment`](#create-comment)
- [`create-issue`](#create-issue)
- [`create-label`](#create-label)
- [`delete-comment`](#delete-comment)
- [`lock-issue`](#lock-issue)
- [`mark-duplicate`](#mark-duplicate)
@@ -144,7 +149,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -186,7 +191,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -211,7 +216,7 @@ Close the specified issue.
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -244,7 +249,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -288,7 +293,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -315,13 +320,41 @@ jobs:
⏫ [Back to list](#List)
#### `create-label`
Create label。If you want to create multiple labels base on repository path. [See](https://github.com/actions-cool/create-labels).
```yml
- name: Create label
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }}
label-name: 'xx'
label-color: '0095b3'
label-desc: 'xx'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](#token) | string | ✔ |
| label-name | Label name, emoji support | string | ✔ |
| label-color | Label color, the format is hexadecimal color code, without `#` | string | ✖ |
| label-desc | Label description | string | ✖ |
- `label-name`: If it already exists, no operation
- `label-color`: Default is `ededed`
⏫ [Back to list](#List)
#### `delete-comment`
According to [`comment-id`](#comment-id) delete the specified comment.
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -353,7 +386,7 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -387,7 +420,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -403,12 +436,12 @@ jobs:
| 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 | ✖ |
| require-permission | Permission required | string | ✖ |
| require-permission | Permission required, default is `write` | string | ✖ |
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
- `labels`: Highest priority
- `close-issue`: Both `true` or `'true'` can take effect
- `require-permission`: When you do not input, there is no limit. Anyone comment will trigger. Optional values are `admin`, `write`, `read`, `none`
- `require-permission`: Optional values are `admin`, `write`, `read`, `none`
- If the team member sets the `read` permission, it is `read`
- If the external Collaborator is set to `read` permission, it is `read`
- Ordinary users have `read` permission
@@ -422,7 +455,7 @@ Open the specified issue.
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -443,7 +476,7 @@ Remove the person designated by issue.
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -466,7 +499,7 @@ Remove the specified labels.
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -491,7 +524,7 @@ Replace the labels of issue.
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -514,7 +547,7 @@ Unlock the specified issue.
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -547,7 +580,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -575,7 +608,7 @@ Update the specified issue according to the `issue-number`.
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -625,7 +658,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -668,7 +701,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -721,7 +754,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -760,7 +793,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -794,7 +827,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.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -842,7 +875,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -889,7 +922,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: month-statistics
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -932,7 +965,7 @@ jobs:
if: github.event.label.name == 'watch'
steps:
- name: find comments
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
id: fcid
with:
actions: 'find-comments'
@@ -943,7 +976,7 @@ jobs:
- name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -952,7 +985,7 @@ jobs:
- name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -984,7 +1017,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.11
uses: actions-cool/issues-helper@v2.1.1
id: createissue
with:
actions: 'create-issue'
@@ -1059,6 +1092,7 @@ 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 or undergoes refactoring, release the advanced v2 version
- After the v2 version, the version will be released strictly according to the three-level semantics, such as v2.0.0, v2.1.0
- 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)

View File

@@ -6,8 +6,8 @@
[![](https://img.shields.io/badge/marketplace-issues--helper-red?style=flat-square)](https://github.com/marketplace/actions/issues-helper)
[![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases)
[![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases)
[![](https://img.shields.io/github/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers)
[![](https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square&color=%2308979c)](https://github.com/actions-cool/issues-helper/discussions)
[![](https://img.shields.io/github/license/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
@@ -56,6 +56,11 @@
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
<div>material-ui</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/prettier/prettier">
<img src="https://github.com/prettier/prettier-logo/blob/master/images/prettier-icon-light.png?raw=true" width="46" />
<div>prettier</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/ant-design/pro-components">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
@@ -66,12 +71,12 @@
<img src="https://avatars3.githubusercontent.com/u/9441414?s=200&v=4" width="46" />
<div>react-component</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/lijinke666/react-music-player">
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
<div>react-music-player</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/umijs/umi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
@@ -87,7 +92,6 @@
<img src="https://avatars1.githubusercontent.com/u/70757173?s=200&v=4" width="46" />
<div>zoo</div>
</a></td>
<td align="center" width="180"></td>
</tr>
</table>
@@ -101,6 +105,7 @@
- [`close-issue`](#close-issue)
- [`create-comment`](#create-comment)
- [`create-issue`](#create-issue)
- [`create-label`](#create-label)
- [`delete-comment`](#delete-comment)
- [`lock-issue`](#lock-issue)
- [`mark-duplicate`](#mark-duplicate)
@@ -144,7 +149,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -186,7 +191,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -211,7 +216,7 @@ jobs:
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -244,7 +249,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -288,7 +293,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -315,13 +320,41 @@ jobs:
⏫ [返回列表](#列-表)
#### `create-label`
新增 label。若想根据目录生成多个 labels[可查看](https://github.com/actions-cool/create-labels)。
```yml
- name: Create label
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }}
label-name: 'xx'
label-color: '0095b3'
label-desc: 'xx'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](#token) | string | ✔ |
| label-name | 标签名称,支持 emoji | string | ✔ |
| label-color | 标签颜色,格式为 16 进制色码,不加 `#` | string | ✖ |
| label-desc | 标签描述 | string | ✖ |
- `label-name`:若已存在,则无操作
- `label-color`:默认为 `ededed`
⏫ [返回列表](#列-表)
#### `delete-comment`
根据 [`comment-id`](#comment-id) 删除指定评论。
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -353,7 +386,7 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -387,7 +420,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -403,12 +436,12 @@ jobs:
| labels | 替换该 issue 的 labels | string | ✖ |
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
| close-issue | 是否同时关闭该 issue | string | ✖ |
| require-permission | 要求权限 | string | ✖ |
| require-permission | 要求权限,默认为 `write` | string | ✖ |
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
- `labels`:优先级最高
- `close-issue``true``'true'` 均可生效
- `require-permission`当不输时,即无限制,任何人评论都会触发。可选值有 `admin``write``read``none`
- `require-permission`:可选值有 `admin``write``read``none`
- 团队成员若设置 `read` 权限,则为 `read`
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
- 普通用户为 `read` 权限
@@ -422,7 +455,7 @@ jobs:
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -443,7 +476,7 @@ jobs:
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -466,7 +499,7 @@ jobs:
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -491,7 +524,7 @@ jobs:
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -514,7 +547,7 @@ jobs:
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -547,7 +580,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -575,7 +608,7 @@ jobs:
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -623,7 +656,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -666,7 +699,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -715,7 +748,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -754,7 +787,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -788,7 +821,7 @@ jobs:
```yml
- name: Find comments
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -836,7 +869,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -883,7 +916,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: month-statistics
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -926,7 +959,7 @@ jobs:
if: github.event.label.name == 'watch'
steps:
- name: find comments
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
id: fcid
with:
actions: 'find-comments'
@@ -937,7 +970,7 @@ jobs:
- name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -946,7 +979,7 @@ jobs:
- name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -978,7 +1011,7 @@ jobs:
```yml
- name: Create issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
id: createissue
with:
actions: 'create-issue'
@@ -1054,6 +1087,7 @@ x2 + y2
- v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定或进行重构时,发布进阶 v2 版本
- v2 版本后会严格按照三级语义来发布版本,如 v2.0.0、v2.1.0
- 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到

View File

@@ -45,6 +45,10 @@ const users = [
url: 'https://github.com/ant-design/pro-components',
logo: 'https://avatars1.githubusercontent.com/u/12101536?s=200&v=4'
},
{
url: 'https://github.com/prettier/prettier',
logo: 'https://github.com/prettier/prettier-logo/blob/master/images/prettier-icon-light.png?raw=true'
},
];
// **************************************************************************

View File

@@ -22,8 +22,16 @@ inputs:
description: 'Issue assignees'
random-to:
description: 'Issue assignees random to'
# label
labels:
description: 'Issue labels'
label-name:
description: 'Create label name'
label-color:
description: 'Create label color, default #ededed'
label-desc:
description: 'Create label description'
state:
description: 'Issue state'
update-mode:

118
dist/index.js vendored
View File

@@ -7985,6 +7985,30 @@ async function doCreateIssueContent(owner, repo, issueNumber, contents) {
}
}
async function doCreateLabel(owner, repo) {
const name = core.getInput('label-name');
const color = core.getInput('label-color') || 'ededed';
const description = core.getInput('label-desc') || '';
if (!name) {
core.setFailed(`This actions should input 'label-name'!`);
return false;
}
try {
await octokit.issues.createLabel({
owner,
repo,
name,
color,
description,
});
core.info(`Actions: [create-label][${name}] success!`);
} catch (err) {
console.log(err.message);
}
}
async function doDeleteComment(owner, repo, commentId) {
await octokit.issues.deleteComment({
owner,
@@ -8020,7 +8044,7 @@ async function doMarkDuplicate(owner, repo, labels) {
const duplicateLabels = core.getInput('duplicate-labels');
const removeLables = core.getInput('remove-labels');
const closeIssue = core.getInput('close-issue');
const requirePermission = core.getInput('require-permission');
const requirePermission = core.getInput('require-permission') || 'write';
const commentId = context.payload.comment.id;
const commentBody = context.payload.comment.body;
@@ -8029,19 +8053,6 @@ async function doMarkDuplicate(owner, repo, labels) {
const ifCommandInput = !!duplicateCommand;
if (requirePermission) {
const res = await octokit.repos.getCollaboratorPermissionLevel({
owner,
repo,
username: commentUser,
});
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
}
if (
!commentBody.includes('?') &&
((ifCommandInput &&
@@ -8049,37 +8060,52 @@ async function doMarkDuplicate(owner, repo, labels) {
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, dealStringToArr(contents));
}
try {
const res = await octokit.repos.getCollaboratorPermissionLevel({
owner,
repo,
username: commentUser,
});
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber,
});
let newLabels = [];
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
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, dealStringToArr(contents));
}
if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber);
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber,
});
let newLabels = [];
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber);
}
} catch (error) {
core.info(error.message);
}
} else {
core.info(
@@ -8315,6 +8341,7 @@ module.exports = {
doCreateCommentContent,
doCreateIssue,
doCreateIssueContent,
doCreateLabel,
doDeleteComment,
doMarkDuplicate,
doLockIssue,
@@ -8344,6 +8371,7 @@ const {
doCloseIssue,
doCreateComment,
doCreateIssue,
doCreateLabel,
doDeleteComment,
doMarkDuplicate,
doLockIssue,
@@ -8374,6 +8402,7 @@ const ALLACTIONS = [
'close-issue',
'create-comment',
'create-issue',
'create-label',
'delete-comment',
'lock-issue',
'mark-duplicate',
@@ -8454,6 +8483,9 @@ async function main() {
case 'create-issue':
await doCreateIssue(owner, repo, title, body, labels, assignees);
break;
case 'create-label':
await doCreateLabel(owner, repo);
break;
case 'delete-comment':
await doDeleteComment(owner, repo, commentId);
break;

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -110,7 +110,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -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.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -188,7 +188,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -233,7 +233,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: month-statistics
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -138,7 +138,7 @@ jobs:
```yml
- name: Find comments
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -184,7 +184,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -229,7 +229,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: month-statistics
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -62,7 +62,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -85,7 +85,7 @@ Close the specified issue.
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -116,7 +116,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -183,13 +183,39 @@ jobs:
- `title` default is `Default Title`
- Return `issue-number`. [Usage reference](/en-US/guide/ref#-outputs-use)
## `create-label`
Create label。If you want to create multiple labels base on repository path. [See](https://github.com/actions-cool/create-labels).
```yml
- name: Create label
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }}
label-name: 'xx'
label-color: '0095b3'
label-desc: 'xx'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
| label-name | Label name, emoji support | string | ✔ |
| label-color | Label color, the format is hexadecimal color code, without `#` | string | ✖ |
| label-desc | Label description | string | ✖ |
- `label-name`: If it already exists, no operation
- `label-color`: Default is `ededed`
## `delete-comment`
According to [`comment-id`](/en-US/guide/ref#-comment-id) delete the specified comment.
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -219,7 +245,7 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -251,7 +277,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -267,12 +293,12 @@ jobs:
| 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 | ✖ |
| require-permission | Permission required | string | ✖ |
| require-permission | Permission required, default is `write` | string | ✖ |
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
- `labels`: Highest priority
- `close-issue`: Both `true` or `'true'` can take effect
- `require-permission`: When you do not input, there is no limit. Anyone comment will trigger. Optional values are `admin`, `write`, `read`, `none`
- `require-permission`: Optional values are `admin`, `write`, `read`, `none`
- If the team member sets the `read` permission, it is `read`
- If the external Collaborator is set to `read` permission, it is `read`
- Ordinary users have `read` permission
@@ -290,7 +316,7 @@ Open the specified issue.
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -309,7 +335,7 @@ Remove the person designated by issue.
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -330,7 +356,7 @@ Remove the specified labels.
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -353,7 +379,7 @@ Replace the labels of issue.
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -374,7 +400,7 @@ Unlock the specified issue.
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -405,7 +431,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -431,7 +457,7 @@ Update the specified issue according to the `issue-number`.
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -479,7 +505,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -62,7 +62,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -85,7 +85,7 @@ jobs:
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -116,7 +116,7 @@ jobs:
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -183,13 +183,39 @@ jobs:
- `title` 默认为:`Default Title`
- 返回 `issue-number`[用法参考](/guide/ref#-outputs-使用)
## `create-label`
新增 label。若想根据目录生成多个 labels[可查看](https://github.com/actions-cool/create-labels)。
```yml
- name: Create label
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }}
label-name: 'xx'
label-color: '0095b3'
label-desc: 'xx'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
| label-name | 标签名称,支持 emoji | string | ✔ |
| label-color | 标签颜色,格式为 16 进制色码,不加 `#` | string | ✖ |
| label-desc | 标签描述 | string | ✖ |
- `label-name`:若已存在,则无操作
- `label-color`:默认为 `ededed`
## `delete-comment`
根据 [`comment-id`](/guide/ref#-comment-id) 删除指定评论。
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -219,7 +245,7 @@ jobs:
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -251,7 +277,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -267,12 +293,12 @@ jobs:
| labels | 替换该 issue 的 labels | string | ✖ |
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
| close-issue | 是否同时关闭该 issue | string | ✖ |
| require-permission | 要求权限 | string | ✖ |
| require-permission | 要求权限,默认为 `write` | string | ✖ |
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
- `labels`:优先级最高
- `close-issue``true``'true'` 均可生效
- `require-permission`当不输时,即无限制,任何人评论都会触发。可选值有 `admin``write``read``none`
- `require-permission`:可选值有 `admin``write``read``none`
- 团队成员若设置 `read` 权限,则为 `read`
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
- 普通用户为 `read` 权限
@@ -290,7 +316,7 @@ jobs:
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -309,7 +335,7 @@ jobs:
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -330,7 +356,7 @@ jobs:
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -353,7 +379,7 @@ jobs:
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -374,7 +400,7 @@ jobs:
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -405,7 +431,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -431,7 +457,7 @@ jobs:
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -478,7 +504,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -9,6 +9,7 @@ toc: menu
- v1 represents the initial version
- The fixes and additions to the v1 version will be released to the v1.1 version
- When the released v1.x runs stable for a certain period of time or undergoes refactoring, release the advanced v2 version
- After the v2 version, the version will be released strictly according to the three-level semantics, such as v2.0.0, v2.1.0
- 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)

View File

@@ -9,6 +9,7 @@ toc: menu
- v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定或进行重构时,发布进阶 v2 版本
- v2 版本后会严格按照三级语义来发布版本,如 v2.0.0、v2.1.0
- 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到

View File

@@ -22,6 +22,10 @@ Yes, you can directly modify `actions`. For example: `actions:'create-comment'`
You can view the detailed [changelog](/en-US/changelog). The latest releases version is recommended.
## What should I pay attention to when upgrading from v1.x to v2?
There is only one difference between v1.12 and v2.0.0. That is, `require-permission` in `mark-duplicate` has added the default value `write`.
## What should I do if there is no function I want here?
You can submit it in [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18).

View File

@@ -22,6 +22,10 @@ GitHub Actions 是由 GitHub 免费提供的。其中 `Private` 项目每月有
你可以查看详细的 [更新日志](/changelog)。推荐采用最新 releases 版本。
## 从 v1.x 升级到 v2有什么注意的地方吗
v1.12 和 v2.0.0 版本的差别只有一处。即 `mark-duplicate` 中的 `require-permission` 增加了默认值 `write`
## 如果这里没有我想要的功能,该怎么办?
你可以在 [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18) 中提出。

View File

@@ -38,6 +38,8 @@ When an action is set, such as adding a label `x1` to an issue, Actions will aut
But if this is done by `GitHub Actions bot` (that is, the token in the actions is not passed, or the default `token: ${{ secrets.GITHUB_TOKEN }}` is used), the actions of label `x2` will not be triggered.
ref: [GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token)
## `assignees` scope
- The owner or collaborator of the warehouse, if there is an organization, including members

View File

@@ -39,6 +39,8 @@ with:
但如果这个是由 `GitHub Actions bot` 完成的(即 actions 中 token 不传,或使用默认 `token: ${{ secrets.GITHUB_TOKEN }}`),则不会触发 label `x2` 的 Actions。
ref: [GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token)
## `assignees` 范围
- 仓库的所有者或协作者,若有组织,包括成员

View File

@@ -33,7 +33,7 @@ jobs:
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@1.x
uses: actions-cool/issues-helper@v2.0.0
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -50,7 +50,7 @@ jobs:
- `on`: The action trigger condition
- Reference [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
- `uses`: Use actions name
- `uses: actions-cool/issues-helper@1.x`。Please [refer](/en-US/changelog) to version selection
- `uses: actions-cool/issues-helper@v2.0.0`。Please [refer](/en-US/changelog) to version selection
- `issues-hepler` parameter
- `actions`: The name of the function used, **required**. Support multiple, separated by commas, such as `create-comment,close-issue` means comment and close issue
- `token`: A person who needs to have push permission token

View File

@@ -33,7 +33,7 @@ jobs:
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@1.x
uses: actions-cool/issues-helper@v2.0.0
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
@@ -50,7 +50,7 @@ jobs:
- `on`action 触发条件
- 参考 [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
- `uses`:使用 actions 名称
- `uses: actions-cool/issues-helper@1.x`。版本选择请 [参考](/changelog)
- `uses: actions-cool/issues-helper@v2.0.0`。版本选择请 [参考](/changelog)
- `issues-hepler` 参数
- `actions`:使用功能的名称,**必填**。支持多个,需用逗号隔开,如 `create-comment,close-issue` 表示评论和关闭 issue
- `token`:需拥有 push 权限的人员 token

View File

@@ -38,7 +38,7 @@ jobs:
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -38,7 +38,7 @@ jobs:
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.11
uses: actions-cool/issues-helper@v2.1.1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,6 +1,6 @@
{
"name": "issues-helper",
"version": "1.12.0",
"version": "2.1.1",
"private": true,
"description": "Some operations on issue.",
"main": "src/main.js",

View File

@@ -1,7 +1,7 @@
const { readFileSync, writeFileSync } = require('fs');
const last = /v1\.10/g;
const now = 'v1.11';
const last = /v2\.1\.1/g;
const now = 'v2.2.0';
let readme = readFileSync('./README.md', 'utf-8');
readme = readme.replace(last, now);

View File

@@ -122,6 +122,30 @@ async function doCreateIssueContent(owner, repo, issueNumber, contents) {
}
}
async function doCreateLabel(owner, repo) {
const name = core.getInput('label-name');
const color = core.getInput('label-color') || 'ededed';
const description = core.getInput('label-desc') || '';
if (!name) {
core.setFailed(`This actions should input 'label-name'!`);
return false;
}
try {
await octokit.issues.createLabel({
owner,
repo,
name,
color,
description,
});
core.info(`Actions: [create-label][${name}] success!`);
} catch (err) {
console.log(err.message);
}
}
async function doDeleteComment(owner, repo, commentId) {
await octokit.issues.deleteComment({
owner,
@@ -157,7 +181,7 @@ async function doMarkDuplicate(owner, repo, labels) {
const duplicateLabels = core.getInput('duplicate-labels');
const removeLables = core.getInput('remove-labels');
const closeIssue = core.getInput('close-issue');
const requirePermission = core.getInput('require-permission');
const requirePermission = core.getInput('require-permission') || 'write';
const commentId = context.payload.comment.id;
const commentBody = context.payload.comment.body;
@@ -166,19 +190,6 @@ async function doMarkDuplicate(owner, repo, labels) {
const ifCommandInput = !!duplicateCommand;
if (requirePermission) {
const res = await octokit.repos.getCollaboratorPermissionLevel({
owner,
repo,
username: commentUser,
});
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
}
if (
!commentBody.includes('?') &&
((ifCommandInput &&
@@ -186,37 +197,52 @@ async function doMarkDuplicate(owner, repo, labels) {
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, dealStringToArr(contents));
}
try {
const res = await octokit.repos.getCollaboratorPermissionLevel({
owner,
repo,
username: commentUser,
});
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber,
});
let newLabels = [];
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
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, dealStringToArr(contents));
}
if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber);
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber,
});
let newLabels = [];
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber);
}
} catch (error) {
core.info(error.message);
}
} else {
core.info(
@@ -452,6 +478,7 @@ module.exports = {
doCreateCommentContent,
doCreateIssue,
doCreateIssueContent,
doCreateLabel,
doDeleteComment,
doMarkDuplicate,
doLockIssue,

View File

@@ -8,6 +8,7 @@ const {
doCloseIssue,
doCreateComment,
doCreateIssue,
doCreateLabel,
doDeleteComment,
doMarkDuplicate,
doLockIssue,
@@ -38,6 +39,7 @@ const ALLACTIONS = [
'close-issue',
'create-comment',
'create-issue',
'create-label',
'delete-comment',
'lock-issue',
'mark-duplicate',
@@ -118,6 +120,9 @@ async function main() {
case 'create-issue':
await doCreateIssue(owner, repo, title, body, labels, assignees);
break;
case 'create-label':
await doCreateLabel(owner, repo);
break;
case 'delete-comment':
await doDeleteComment(owner, repo, commentId);
break;