chore: improved docs (#152)

* chore: improved docs

* chore: format code

* deps: upgrade dumi 2.1.21

fix https://github.com/actions-cool/issues-helper/issues/153

* chore: update style

* docs: update docs
This commit is contained in:
Wuxh
2023-04-17 19:09:03 +08:00
committed by GitHub
parent 5586509e90
commit 36a1dd8767
12 changed files with 197 additions and 1979 deletions

View File

@@ -1,422 +1,5 @@
---
toc: menu
title: 🌟 Advanced
---
# 🌟 Advanced
Advanced usage is not recommended to use multiple actions at the same time.
## `check-inactive`
At UTC 0 on the 1st of each month, add the `inactive` tag to all issues that have not been active for more than 30 days.
```yml
name: Check inactive
on:
schedule:
- cron: "0 0 1 * *"
jobs:
check-inactive:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v3
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
| contents | Add [reaction](/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 | ✖ |
| exclude-labels | Exclude labels filtering | 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`
- `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
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `check-issue`
Check whether the issue meets the conditions according to the passed parameters and `issue-number`, and return a boolean value.
The effect of the following example is: when an issue is newly opened, verify whether the current issue designator contains `x1` or `x2`.
If one designated person is satisfied, the verification will pass, and at the same time, verify whether the title meets the conditions.
[Check rules](/guide/ref#-includes-check-rules)
```yml
name: Check Issue
on:
issues:
types: [edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v3
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignee-includes: 'x1,x2'
title-includes: 'x1,x2/y1,y2'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| assignee-includes | Assignees contains check | string | ✖ |
| title-includes | Title contains check | string | ✖ |
| title-excludes | Check whether the title is empty after removing the default title | 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`, due to yml reasons, the judgment condition is `if: steps.xxid.outputs.check-result =='true'`
## `close-issues`
Every 7 days at UTC 0, close the issues that have been filled with the `need info` label and have not been active for more than 7 days.
```yml
name: Check need info
on:
schedule:
- cron: "0 0 */7 * *"
jobs:
check-need-info:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need info'
inactive-day: 7
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
| contents | Add [reaction](/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 | ✖ |
| exclude-labels | Exclude labels filtering | string | ✖ |
| close-reason | Reason for closing. Default `not_planned`, another `completed` | string | ✖ |
- `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
- `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
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `find-comments`
Find the current warehouse issue No. 1, the creator is k and the content contains the comment list of `this`.
```yml
- name: Find comments
uses: actions-cool/issues-helper@v3
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: 1
comment-auth: 'k'
body-includes: 'this'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | 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:
```js
[
{id: 1, auth: 'x', body: 'xxx', created: '', updated: ''},
{id: 2, auth: 'x', body: 'xxx', created: '', updated: ''},
]
```
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
## `find-issues`
Find the current repository, the creator is k , the title contains `this` , the body contains `that`, and the list of issues in the open state.
```yml
- name: Find issues
uses: actions-cool/issues-helper@v3
with:
actions: 'find-issues'
token: ${{ secrets.GITHUB_TOKEN }}
issue-creator: 'k'
issue-state: 'open'
title-includes: 'this'
body-includes: 'that'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-state | State filtering | string | ✖ |
| issue-creator | Creator filtering | string | ✖ |
| title-includes | Title filtering | string | ✖ |
| body-includes | Body filtering | string | ✖ |
| exclude-labels | Exclude labels filtering | string | ✖ |
| inactive-day | Inactive days filtering | number | ✖ |
| direction | Return sort | string | ✖ |
- Returns `issues` in the following format:
```js
[
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', created: '', updated: ''},
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', created: '', updated: ''},
]
```
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `lock-issues`
Every 3 months at UTC 0 on the 1st, lock all issues that have been filled with the `inactive` label and have not been active for more than 128 days.
```yml
name: Lock inactive issues
on:
schedule:
- cron: "0 0 1 */3 *"
jobs:
lock-issues:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v3
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'inactive'
inactive-day: 128
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ |
| contents | Add [reaction](/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 | ✖ |
| lock-reason | Reason for locking issue | string | ✖ |
| exclude-labels | Exclude labels filtering | 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`
- `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
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
## `mark-assignees`
Quickly assign person, only for the issue to add editor comments.
```yml
name: Issue Mark Assignees
on:
issue_comment:
types: [created, edited]
jobs:
mark-assignees:
runs-on: ubuntu-latest
steps:
- name: mark-assignees
uses: actions-cool/issues-helper@v3
with:
actions: 'mark-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| assign-command | Simple commands can be set, such as: `/a` | string | ✖ |
| require-permission | Permission required, default is `write` | string | ✖ |
- `assign-command`: default `/assign`
- `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
- When set `write`, `admin` and `write` meet the conditions
## `mark-duplicate`
Quickly mark duplicate questions, only for issue new comments or edit comments.
```yml
name: Issue Mark Duplicate
on:
issue_comment:
types: [created, edited]
jobs:
mark-duplicate:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
uses: actions-cool/issues-helper@v3
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| duplicate-command | Simple commands can be set, such as: `/d` | string | ✖ |
| duplicate-labels | Add additional labels to this issue | string | ✖ |
| remove-labels | Set removable labels | string | ✖ |
| labels | Replace the labels of the issue | string | ✖ |
| emoji | Add [emoji](/guide/ref#-emoji-type) for this comment | string | ✖ |
| close-issue | Whether to close the issue at the same time | string | ✖ |
| require-permission | Permission required, default is `write` | string | ✖ |
| close-reason | Reason for closing. Default `not_planned`, another `completed` | 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`: 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
- When set `write`, `admin` and `write` meet the conditions
:::info{title=Note}
Duplicate created with the concise command does not display the content of the red box in the figure below. But in fact this has no effect.
:::
![](https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*PN2tS7PjDQ4AAAAAAAAAAAAAARQnAQ)
## `toggle-labels`
When an issue is reopened, the set labels are removed if they already exist, otherwise they are added.
```yml
name: Toggle Labels
on:
issues:
types: [reopened]
jobs:
toggle-labels:
runs-on: ubuntu-latest
steps:
- name: Toggle labels
uses: actions-cool/issues-helper@v3
with:
actions: 'toggle-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'unread,outdated'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| labels | The toggle labels. Delete if the label already exists, add if it does not exist | string | ✖ |
## `welcome`
When an issue is created, the user who created the issue for the first time is welcome.
If the user is not creating for the first time, there is no operation.
```yml
name: Issue Welcome
on:
issues:
types: [opened]
jobs:
issue-welcome:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v3
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
body: hi @${{ github.event.issue.user.login }}, welcome!
labels: 'welcome1, welcome2'
assignees: 'xx1'
issue-emoji: '+1, -1, eyes'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/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-emoji | Add [emoji](/guide/ref#-emoji-type) to this issue| string | ✖ |
- If these 4 options are not filled, no operation
<embed src="../../README.md#RE-/<wrapper advanced [^>]*>([\s\S]*?)<\/wrapper>/"></embed>

View File

@@ -1,417 +1,5 @@
---
toc: menu
title: 🌟 进 阶
---
# 🌟 进 阶
进阶用法不建议 actions 多个一次同时使用。
## `check-inactive`
每月 1 号 UTC 0 时,对所有 30 天以上未活跃的 issues 增加 `inactive` 标签。
```yml
name: Check inactive
on:
schedule:
- cron: "0 0 1 * *"
jobs:
check-inactive:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v3
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
| emoji | 为该评论增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | 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 | ✖ |
| exclude-labels | 排除标签筛选 | string | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
## `check-issue`
根据传入的参数和 `issue-number` 来检查该 issue 是否满足条件,返回一个布尔值。
下面的例子效果是:当 issue 新开时,校验当前 issue 指定人是否包含 `x1` 或者 `x2`,满足一个指定人即可校验通过,同时校验标题是否满足条件,[校验规则](/zh-CN/guide/ref#-includes-校验规则)。
```yml
name: Check Issue
on:
issues:
types: [edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v3
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignee-includes: 'x1,x2'
title-includes: 'x1,x2/y1,y2'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| assignee-includes | 是否包含指定人 | string | ✖ |
| title-includes | 标题包含校验 | string | ✖ |
| title-excludes | 检测标题移除默认 title 后是否为空 | string | ✖ |
| body-includes | 内容包含校验 | string | ✖ |
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
- 返回 `check-result`,由于 yml 原因,判断条件为 `if: steps.xxid.outputs.check-result == 'true'`
## `close-issues`
每 7 天 UTC 0 时,关闭已填加 `need info` label 且 7 天以上未活跃的 issues。
```yml
name: Check need info
on:
schedule:
- cron: "0 0 */7 * *"
jobs:
check-need-info:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need info'
inactive-day: 7
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
| emoji | 为该评论增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
| labels | 标签筛选 | string | ✖ |
| issue-assignee | 指定人筛选 | string | ✖ |
| issue-creator | 创建人筛选 | string | ✖ |
| issue-mentioned | 提及人筛选 | string | ✖ |
| body-includes | 包含内容筛选 | string | ✖ |
| title-includes | 包含标题筛选 | string | ✖ |
| inactive-day | 非活跃天数筛选 | number | ✖ |
| exclude-labels | 排除标签筛选 | string | ✖ |
| close-reason | 关闭原因。默认`not_planned`未计划,`completed`完成 | string | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
## `find-comments`
查找当前仓库 1 号 issue 中,创建者是 k ,内容包含 `this` 的评论列表。
```yml
- name: Find comments
uses: actions-cool/issues-helper@v3
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: 1
comment-auth: 'k'
body-includes: 'this'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ |
| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ |
| direction | 返回 `comments` 排序 | string | ✖ |
- 返回 `comments`,格式如下:
```js
[
{id: 1, auth: 'x', body: 'xxx', created: '', updated: ''},
{id: 2, auth: 'x', body: 'xxx', created: '', updated: ''},
]
```
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
## `find-issues`
查找当前仓库,创建者是 k title 包含 `this` body 包含 `that`,打开状态的 issues 列表。
```yml
- name: Find issues
uses: actions-cool/issues-helper@v3
with:
actions: 'find-issues'
token: ${{ secrets.GITHUB_TOKEN }}
issue-creator: 'k'
issue-state: 'open'
title-includes: 'this'
body-includes: 'that'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-state | 状态筛选 | string | ✖ |
| issue-creator | 创建者筛选 | string | ✖ |
| title-includes | 标题包含过滤,不填时无校验 | string | ✖ |
| body-includes | 内容包含过滤,不填时无校验 | string | ✖ |
| exclude-labels | 排除标签筛选 | string | ✖ |
| inactive-day | 非活跃天数筛选 | number | ✖ |
| direction | 返回 `issues` 排序 | string | ✖ |
- 返回 `issues`,格式如下:
```js
[
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', created: '', updated: ''},
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', created: '', updated: ''},
]
```
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
## `lock-issues`
每 3 个月 1 号 UTC 0 时,锁定已填加 `inactive` label 且 128 天以上未活跃的所有 issues。
```yml
name: Lock inactive issues
on:
schedule:
- cron: "0 0 1 */3 *"
jobs:
lock-issues:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v3
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'inactive'
inactive-day: 128
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ |
| emoji | 为该评论增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
| labels | 标签筛选 | string | ✖ |
| issue-state | 状态筛选 | string | ✖ |
| issue-assignee | 指定人筛选 | string | ✖ |
| issue-creator | 创建人筛选 | string | ✖ |
| issue-mentioned | 提及人筛选 | string | ✖ |
| body-includes | 包含内容筛选 | string | ✖ |
| title-includes | 包含标题筛选 | string | ✖ |
| inactive-day | 非活跃天数筛选 | number | ✖ |
| lock-reason | 锁定 issue 的原因 | string | ✖ |
| exclude-labels | 排除标签筛选 | string | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
## `mark-assignees`
快捷加指定人,仅作用于 issue 新增编辑评论。
```yml
name: Issue Mark Assignees
on:
issue_comment:
types: [created, edited]
jobs:
mark-assignees:
runs-on: ubuntu-latest
steps:
- name: mark-assignees
uses: actions-cool/issues-helper@v3
with:
actions: 'mark-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| assign-command | 可设置简洁命令,如:`/a` | string | ✖ |
| require-permission | 要求权限,默认为 `write` | string | ✖ |
- `assign-command`:可设置简洁命令。默认:`/assign`
- `require-permission`:可选值有 `admin``write``read``none`
- 团队成员若设置 `read` 权限,则为 `read`
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
- 普通用户为 `read` 权限
- 当设置 `write` 后,`admin``write` 满足条件
## `mark-duplicate`
快捷标记重复问题,仅作用于 issue 新增编辑评论。
```yml
name: Issue Mark Duplicate
on:
issue_comment:
types: [created, edited]
jobs:
mark-duplicate:
runs-on: ubuntu-latest
steps:
- name: mark-duplicate
uses: actions-cool/issues-helper@v3
with:
actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }}
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| duplicate-command | 可设置简洁命令,如:`/d` | string | ✖ |
| duplicate-labels | 为该 issue 额外增加 labels | string | ✖ |
| remove-labels | 设置可移除的 labels | string | ✖ |
| labels | 替换该 issue 的 labels | string | ✖ |
| emoji | 为该评论的增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
| close-issue | 是否同时关闭该 issue | string | ✖ |
| require-permission | 要求权限,默认为 `write` | string | ✖ |
| close-reason | 关闭原因。默认`not_planned`未计划,`completed`完成 | string | ✖ |
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
- `labels`:优先级最高
- `close-issue``true``'true'` 均可生效
- `require-permission`:可选值有 `admin``write``read``none`
- 团队成员若设置 `read` 权限,则为 `read`
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
- 普通用户为 `read` 权限
- 当设置 `write` 后,`admin``write` 满足条件
:::info{title=注意}
使用简洁命令创建的 Duplicate 不显示下图红框内容。但其实这个没有任何影响的。
:::
![](https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*PN2tS7PjDQ4AAAAAAAAAAAAAARQnAQ)
## `toggle-labels`
当一个 issue 被重新打开,判断设置的 labels 如果已经存在则进行删除,否则进行添加。
```yml
name: Toggle Labels
on:
issues:
types: [reopened]
jobs:
toggle-labels:
runs-on: ubuntu-latest
steps:
- name: Toggle labels
uses: actions-cool/issues-helper@v3
with:
actions: 'toggle-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'unread,outdated'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| labels | 切换 labels。如果 label 已存在则删除,不存在则添加 | string | ✖ |
## `welcome`
当一个 issue 新建时,对首次新建 issue 的用户进行欢迎。若用户非首次新建,则无操作。
```yml
name: Issue Welcome
on:
issues:
types: [opened]
jobs:
issue-welcome:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v3
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
body: hi @${{ github.event.issue.user.login }}, welcome!
labels: 'welcome1, welcome2'
assignees: 'xx1'
issue-emoji: '+1, -1, eyes'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✔ |
| body | 评论欢迎的内容,不填则不评论 | string | ✖ |
| labels | 为该 issue 增加 labels | string | ✖ |
| assignees | 为该 issue 增加 assignees | string | ✖ |
| issue-emoji | 为该 issue 增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
- 若这 4 个可选项都不填,则无操作
<embed src="../../README.zh-CN.md#RE-/<wrapper advanced [^>]*>([\s\S]*?)<\/wrapper>/"></embed>

View File

@@ -1,460 +1,5 @@
---
toc: menu
title: ⭐ Base
---
# ⭐ Base
In order to better display the function, the following is an example of the actual scene, please refer to it flexibly.
## `add-assignees`
When an issue is added or modified, assign this issue to one or more people.
```yml
name: Add Assigness
on:
issues:
types: [opened, edited]
jobs:
add-assigness:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v3
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2'
random-to: 1
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| assignees | Designated person. No operation when no input or empty character | string | ✖ |
| random-to | When set, it will be randomly selected in assignees | number | ✖ |
- `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](/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
- You can assign up to 10 people to each issue
## `add-labels`
When the content of a new issue does not contain the specified format, add labels for the issue.
```yml
name: Add Labels
on:
issues:
types: [opened]
jobs:
add-labels:
runs-on: ubuntu-latest
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v3
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug' or 'xx1,xx2'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | 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
## `close-issue`
Close the specified issue.
```yml
- name: Close issue
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| close-reason | Reason for closing. Default `not_planned`, another `completed` | string | ✖ |
## `create-comment`
When a designated label is added, comment on the issue.
```yml
name: Create Comment
on:
issues:
types: [labeled]
jobs:
create-comment:
runs-on: ubuntu-latest
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Add some comments.
你好 @${{ github.event.issue.user.login }}。巴拉巴拉。
emoji: '+1' or '+1,heart'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| body | Add comment content | string | ✖ |
| emoji | Add [emoji](/guide/ref#-emoji-type) | string | ✖ |
- No action when `body` is empty
- Return `comment-id`, which can be used for subsequent operations. [Usage reference](/guide/ref#-outputs-use)
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
- `emoji` support multiple and separated by comma
## `create-issue`
Here is an example, add an issue at UTC 00:00 on the 1st of every month.
```yml
name: Create Issue
on:
schedule:
- cron: "0 0 1 * *"
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v3
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: 'xxxx'
body: 'xxxx'
labels: 'xx'
assignees: 'xxx'
emoji: '+1'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/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 | ✖ |
| random-to | When set, it will be randomly selected in assignees | number | ✖ |
| emoji | Add [emoji](/guide/ref#-emoji-type) | string | ✖ |
- `title` default is `Default Title`
- Return `issue-number`. [Usage reference](/guide/ref#-outputs-use)
## `create-label`
Create label. If you want to maintain labels in batches, [see](https://github.com/actions-cool/labels-helper).
```yml
- name: Create label
uses: actions-cool/issues-helper@v3
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](/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`](/guide/ref#-comment-id) delete the specified comment.
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v3
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| comment-id | The comment ID | number | ✔ |
## `get-issue`
Query issue information.
```yml
- name: Get Issue
uses: actions-cool/issues-helper@v3
with:
actions: 'get-issue'
token: ${{ secrets.GITHUB_TOKEN }}
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
- Return `issue-number` `issue-title` `issue-body` `issue-labels` `issue-assignees` `issue-state`. [Usage reference](/guide/ref#-outputs-use)
## `lock-issue`
When the `invalid` label is added, the issue is locked.
```yml
name: Lock Issue
on:
issues:
types: [labeled]
jobs:
lock-issue:
runs-on: ubuntu-latest
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v3
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| lock-reason | Reason for locking issue | string | ✖ |
- `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam`
## `open-issue`
Open the specified issue.
```yml
- name: Open issue
uses: actions-cool/issues-helper@v3
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
## `remove-assignees`
Remove the person designated by issue.
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v3
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xx'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ |
## `remove-labels`
Remove the specified labels.
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v3
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | 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
## `set-labels`
Replace the labels of issue.
```yml
- name: Set labels
uses: actions-cool/issues-helper@v3
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
| labels | labels set. When empty characters, will remove all | string | ✔ |
## `unlock-issue`
Unlock the specified issue.
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v3
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
## `update-comment`
Update the specified comment according to [`comment-id`](/guide/ref#-comment-id).
The following example shows that 👀 is added for each new comment.
```yml
name: Add eyes to each comment
on:
issue_comment:
types: [created]
jobs:
update-comment:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v3
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
emoji: 'eyes'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| comment-id | The comment ID | number | ✔ |
| out-comments | The output of `find-comments`, if you find multiple, operate multiple | string | ✖ |
| body | Update the content of comment | string | ✖ |
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ |
| emoji | Add [emoji](/guide/ref#-emoji-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`
- When `out-comments` is entered, `comment-id` does not work
## `update-issue`
Update the specified issue according to the `issue-number`.
```yml
- name: Update issue
uses: actions-cool/issues-helper@v3
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
state: 'open'
title: 'xxx'
body: 'xxxx'
update-mode: 'replace'
labels: 'xx'
assignees: 'xxx'
emoji: '+1'
```
| Param | Desc | Type | Required |
| -- | -- | -- | -- |
| actions | Action type | string | ✔ |
| token | [Token explain](/guide/ref#-token) | string | ✖ |
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | 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 | ✖ |
| emoji | Add [emoji](/guide/ref#-emoji-type) | string | ✖ |
- `state` defaults to `open`
- When the option is not filled, it will keep the original
<embed src="../../README.md#RE-/<wrapper base [^>]*>([\s\S]*?)<\/wrapper>/"></embed>

View File

@@ -1,460 +1,5 @@
---
toc: menu
title: ⭐ 基 础
---
为了更好的展示功能,下面以实际场景举例,请灵活参考。
# ⭐ 基 础
## `add-assignees`
当一个 issue 新增或修改时,将这个 issue 指定某人或多人。
```yml
name: Add Assigness
on:
issues:
types: [opened, edited]
jobs:
add-assigness:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v3
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2'
random-to: 1
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ |
| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ |
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改
- [on 参考](/zh-CN/guide/ref#-github-相关文档)
- `${{ github.event.issue.number }}` 表示当前 issue[更多参考](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
- `assignees` 支持多个,需用逗号隔开
- assign 最多只能设定 10 个
## `add-labels`
当一个新增的 issue 内容不包含指定格式时,为这个 issue 添加 labels。
```yml
name: Add Labels
on:
issues:
types: [opened]
jobs:
add-labels:
runs-on: ubuntu-latest
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v3
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug' or 'bug1,bug2'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| labels | 新增的 labels。当不填或者为空字符时不新增 | string | ✖ |
- `labels` 支持多个,需用逗号隔开
## `close-issue`
关闭指定 issue。
```yml
- name: Close issue
uses: actions-cool/issues-helper@v3
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| close-reason | 关闭原因。默认`not_planned`未计划,`completed`完成 | string | ✖ |
## `create-comment`
当新增一个指定 label 时,对该 issue 进行评论。
```yml
name: Create Comment
on:
issues:
types: [labeled]
jobs:
create-comment:
runs-on: ubuntu-latest
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v3
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello ${{ github.event.issue.user.login }}. Add some comments.
你好 ${{ github.event.issue.user.login }}。巴拉巴拉。
emoji: '+1' or '+1,heart'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| body | 新增评论的内容 | string | ✖ |
| emoji | 为新增评论的增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
- `body` 为空时,无操作
- 返回 `comment-id`,可用于之后操作。[用法参考](/zh-CN/guide/ref#-outputs-使用)
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
- `emoji` 支持多个,需用逗号隔开
## `create-issue`
感觉新增 issue 使用场景不多。这里举例,每月 1 号 UTC 00:00 新增一个 issue。
```yml
name: Create Issue
on:
schedule:
- cron: "0 0 1 * *"
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v3
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: 'xxxx'
body: 'xxxx'
labels: 'xx'
assignees: 'xxx'
emoji: '+1'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| title | 新增 issue 的标题 | string | ✖ |
| body | 新增 issue 的内容 | string | ✖ |
| labels | 为新增 issue 添加 labels | string | ✖ |
| assignees | 为新增 issue 添加 assignees | string | ✖ |
| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ |
| emoji | 为新增 issue 增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
- `title` 默认为:`Default Title`
- 返回 `issue-number`[用法参考](/zh-CN/guide/ref#-outputs-使用)
## `create-label`
新增 label。若想批量维护 labels[可查看](https://github.com/actions-cool/labels-helper)。
```yml
- name: Create label
uses: actions-cool/issues-helper@v3
with:
actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }}
label-name: 'xx'
label-color: '0095b3'
label-desc: 'xx'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| label-name | 标签名称,支持 emoji | string | ✔ |
| label-color | 标签颜色,格式为 16 进制色码,不加 `#` | string | ✖ |
| label-desc | 标签描述 | string | ✖ |
- `label-name`:若已存在,则无操作
- `label-color`:默认为 `ededed`
## `delete-comment`
根据 [`comment-id`](/zh-CN/guide/ref#-comment-id) 删除指定评论。
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v3
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| comment-id | 指定的 comment | number | ✔ |
## `get-issue`
查询 issue 信息。
```yml
- name: Get Issue
uses: actions-cool/issues-helper@v3
with:
actions: 'get-issue'
token: ${{ secrets.GITHUB_TOKEN }}
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
- 返回 `issue-number` `issue-title` `issue-body` `issue-labels` `issue-assignees` `issue-state`[用法参考](/zh-CN/guide/ref#-outputs-使用)
## `lock-issue`
当新增 `invalid` label 时,对该 issue 进行锁定。
```yml
name: Lock Issue
on:
issues:
types: [labeled]
jobs:
lock-issue:
runs-on: ubuntu-latest
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v3
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| lock-reason | 锁定 issue 的原因 | string | ✖ |
- `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam`
## `open-issue`
打开指定 issue。
```yml
- name: Open issue
uses: actions-cool/issues-helper@v3
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
## `remove-assignees`
移除 issue 指定人员。
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v3
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xx'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ |
## `remove-labels`
移除指定 labels。
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v3
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| labels | 移除的 labels。当为空字符时不进行移除 | string | ✔ |
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
## `set-labels`
替换 issue 的 labels。
```yml
- name: Set labels
uses: actions-cool/issues-helper@v3
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
| labels | labels 设置。当空字符时,会移除所有 | string | ✔ |
## `unlock-issue`
解锁指定 issue。
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v3
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| issue-number | 指定的 issue当不传时会从触发事件中获取 | number | ✖ |
## `update-comment`
根据 [`comment-id`](/zh-CN/guide/ref#-comment-id) 更新指定评论。
下面的例子展示的是,为每个新增的 comment 增加 👀 。
```yml
name: Add eyes to each comment
on:
issue_comment:
types: [created]
jobs:
update-comment:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v3
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
emoji: 'eyes'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/guide/ref#-token-说明) | string | ✖ |
| comment-id | 指定的 comment | number | ✔ |
| out-comments | `find-comments` 的输出,若查找多个,则操作多个 | string | ✖ |
| body | 更新 comment 的内容 | string | ✖ |
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ |
| emoji | 增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
- `body` 不填时,会保持原有
- `update-mode``append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
-`out-comments` 输入时,`comment-id` 不起作用
## `update-issue`
根据 `issue-number` 更新指定 issue。
```yml
- name: Update issue
uses: actions-cool/issues-helper@v3
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
state: 'open'
title: 'xxx'
body: 'xxxx'
update-mode: 'replace'
labels: 'xx'
assignees: 'xxx'
emoji: '+1'
```
| 参数 | 描述 | 类型 | 必填 |
| -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ |
| token | [token 说明](/zh-CN/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 | ✖ |
| emoji | 增加 [emoji](/zh-CN/guide/ref#-emoji-类型) | string | ✖ |
- `state` 默认为 `open`
- 当可选项不填时,会保持原有
<embed src="../../README.zh-CN.md#RE-/<wrapper base [^>]*>([\s\S]*?)<\/wrapper>/"></embed>

View File

@@ -2,85 +2,4 @@
title: 🎁 Reference
---
## 📍 `token`
Need to have the person token with push permission.
- [Personal token application](https://github.com/settings/tokens)
- Need to check `Full control of private repositories`
- Project add secrets
- Select settings, select secrets, select `New repository secret`
- `Name` is the same as in actions
- `Value` fill in the token just applied by the individual
When the token is not filled in actions or input `${{ secrets.GITHUB_TOKEN }}`, it will default to `github-actions-bot`. [More](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow).
## 📍 GitHub Docs
- [Workflow syntax for GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
## 📍 `outputs` use
```yml
- name: Create issue
uses: actions-cool/issues-helper@v1
id: createissue
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check outputs
run: echo "Outputs issue_number is ${{ steps.createissue.outputs.issue-number }}"
```
More:
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
2. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
## 📍 `includes` check rules
```js
"title-includes": 'x1,x2'
x1
x2
"x1y3y2" true
"y2 x1" true
"x2" true
"x3" false
```
```js
"title-includes": 'x1,x2/y1,y2'
x1 + y1
x2 + y1
x1 + y2
x2 + y2
"x1y3y2" true
"y2 x1" true
"1x2y" false
"x1" false
```
## 📍 `emoji` Type
| content | emoji |
| -- | -- |
| `+1` | 👍 |
| `-1` | 👎 |
| `laugh` | 😄 |
| `confused` | 😕 |
| `heart` | ❤️ |
| `hooray` | 🎉 |
| `rocket` | 🚀 |
| `eyes` | 👀 |
For details, please [view](https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions).
## 📍 `comment-id`
Click the `···` icon in the upper right corner of a comment, select `Copy link`, and the number at the end of the url is `comment_id`.
<embed src="../../../README.md#RE-/<wrapper reference [^>]*>([\s\S]*?)<\/wrapper>/"></embed>

View File

@@ -2,85 +2,4 @@
title: 🎁 参 考
---
## 📍 `token` 说明
需拥有 push 权限的人员 token。
- [个人 token 申请](https://github.com/settings/tokens)
- 需勾选 `Full control of private repositories`
- 项目添加 secrets
- 选择 settings选择 secrets选择 `New repository secret`
- `Name` 与 actions 中保持一致
- `Value` 填写刚才个人申请的 token
当 actions 不填写 token 时,或输入 `${{ secrets.GITHUB_TOKEN }}`,会默认为 `github-actions-bot`。[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow)。
## 📍 GitHub 相关文档
- [GitHub Actions 语法](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
## 📍 `outputs` 使用
```yml
- name: Create issue
uses: actions-cool/issues-helper@v1
id: createissue
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check outputs
run: echo "Outputs issue_number is ${{ steps.createissue.outputs.issue-number }}"
```
更多查看:
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
2. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
## 📍 `includes` 校验规则
```js
"title-includes": 'x1,x2'
x1
x2
"x1y3y2" true
"y2 x1" true
"x2" true
"x3" false
```
```js
"title-includes": 'x1,x2/y1,y2'
x1 + y1
x2 + y1
x1 + y2
x2 + y2
"x1y3y2" true
"y2 x1" true
"1x2y" false
"x1" false
```
## 📍 `emoji` 类型
| content | emoji |
| -- | -- |
| `+1` | 👍 |
| `-1` | 👎 |
| `laugh` | 😄 |
| `confused` | 😕 |
| `heart` | ❤️ |
| `hooray` | 🎉 |
| `rocket` | 🚀 |
| `eyes` | 👀 |
如需详细了解,可 [查看](https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions)。
## 📍 `comment-id`
点击某个评论右上角 `···` 图标,选择 `Copy link`url 末尾数字即是 `comment_id`
<embed src="../../../README.zh-CN.md#RE-/<wrapper reference [^>]*>([\s\S]*?)<\/wrapper>/"></embed>