From 36a1dd87678a345b8157ea5584e05a4c3f5d5e84 Mon Sep 17 00:00:00 2001 From: Wuxh Date: Mon, 17 Apr 2023 19:09:03 +0800 Subject: [PATCH] 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 --- README.md | 74 +++--- README.zh-CN.md | 71 +++--- package.json | 2 +- web/.dumi/global.less | 5 + web/.dumirc.ts | 3 + web/docs/advanced.md | 421 +-------------------------------- web/docs/advanced.zh-CN.md | 416 +------------------------------- web/docs/base.md | 459 +----------------------------------- web/docs/base.zh-CN.md | 459 +----------------------------------- web/docs/guide/ref.md | 83 +------ web/docs/guide/ref.zh-CN.md | 83 +------ web/remark-plugins/index.ts | 100 ++++++++ 12 files changed, 197 insertions(+), 1979 deletions(-) create mode 100644 web/remark-plugins/index.ts diff --git a/README.md b/README.md index 3aee279..f2e76c8 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,7 @@ When the following list does not have the features you want, you can submit it i ## 🚀 Usage ### ⭐ Base + In order to better display the function, the following is an example of the actual scene, please refer to it flexibly. @@ -304,7 +305,7 @@ jobs: - `assignees` support multiple and separated by comma - You can assign up to 10 people to each issue -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `add-labels` @@ -340,7 +341,7 @@ jobs: - `labels` support multiple and separated by comma -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `close-issue` @@ -362,7 +363,7 @@ Close the specified issue. | 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 | ✖ | -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `create-comment` @@ -406,7 +407,7 @@ jobs: - `${{ github.event.issue.user.login }}` indicates the creator of the issue - `emoji` support multiple and separated by comma -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `create-issue` @@ -449,7 +450,7 @@ jobs: - No action when `title` is empty - Return `issue-number`. [Usage reference](#outputs-use) -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `create-label` @@ -477,7 +478,7 @@ Create label. If you want to maintain labels in batches, [see](https://github.co - `label-name`: If it already exists, no operation - `label-color`: Default is `ededed` -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `delete-comment` @@ -498,7 +499,7 @@ According to [`comment-id`](#comment-id) delete the specified comment. | token | [Token explain](#token) | string | ✖ | | comment-id | The comment ID | number | ✔ | -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `get-issue` @@ -519,7 +520,7 @@ Query issue information. - Return `issue-number` `issue-title` `issue-body` `issue-labels` `issue-assignees` `issue-state`. [Usage reference](#outputs-use) -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `lock-issue` @@ -554,7 +555,7 @@ jobs: - `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam` -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `open-issue` @@ -575,7 +576,7 @@ Open the specified issue. | token | [Token explain](#token) | string | ✖ | | issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ | -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `remove-assignees` @@ -598,7 +599,7 @@ Remove the person designated by issue. | 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 | ✔ | -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `remove-labels` @@ -623,7 +624,7 @@ Remove the specified labels. - `labels` supports multiple, such as `x1,x2,x3`, only the labels added by the issue will be removed -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `set-labels` @@ -646,7 +647,7 @@ Replace the labels of issue. | 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 | ✔ | -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `unlock-issue` @@ -667,7 +668,7 @@ Unlock the specified issue. | token | [Token explain](#token) | string | ✖ | | issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ | -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `update-comment` @@ -708,7 +709,7 @@ jobs: - 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` -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `update-issue` @@ -746,9 +747,11 @@ Update the specified issue according to the `issue-number`. - `state` defaults to `open` - When the option is not filled, it will keep the original -⏫ [Back to list](#List) +[⏫ Back to list](#List) + ### 🌟 Advanced + Advanced usage is not recommended to use multiple actions at the same time. @@ -799,7 +802,7 @@ jobs: - `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 -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `check-issue` @@ -807,9 +810,7 @@ Check whether the issue meets the conditions according to the passed parameters 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](#check-rules) +If one designated person is satisfied, the verification will pass, and at the same time, verify whether the title meets the conditions. [Check rules](#check-rules) ```yml name: Check Issue @@ -845,7 +846,7 @@ jobs: - `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'` -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `close-issues` @@ -892,7 +893,7 @@ jobs: - `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all - `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `find-comments` @@ -930,7 +931,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain - `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 -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `find-issues` @@ -975,7 +976,7 @@ Find the current repository, the creator is k , the title contains `this` , the - 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 -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `lock-issues` @@ -1024,7 +1025,7 @@ jobs: - `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all - `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `mark-assignees` @@ -1062,7 +1063,7 @@ jobs: - Ordinary users have `read` permission - When set `write`, `admin` and `write` meet the conditions -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `mark-duplicate` @@ -1108,7 +1109,7 @@ jobs: - Ordinary users have `read` permission - When set `write`, `admin` and `write` meet the conditions -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `toggle-labels` @@ -1141,7 +1142,7 @@ jobs: | 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 | ✖ | -⏫ [Back to list](#List) +[⏫ Back to list](#List) #### `welcome` @@ -1182,9 +1183,11 @@ jobs: - If these 4 options are not filled, no operation -⏫ [Back to list](#List) +[⏫ Back to list](#List) + ## 🎁 Reference + ### token @@ -1199,14 +1202,14 @@ Need to have the person token with push permission. 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). -⏫ [Back to list](#List) +[⏫ Back to list](#List) ### 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) -⏫ [Back to list](#List) +[⏫ Back to list](#List) ### `outputs` use @@ -1226,7 +1229,7 @@ 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 -⏫ [Back to list](#List) +[⏫ Back to list](#List) ### Check rules @@ -1256,7 +1259,7 @@ x2 + y2 "x1" false ``` -⏫ [Back to list](#List) +[⏫ Back to list](#List) ### Emoji types | content | emoji | @@ -1270,13 +1273,14 @@ x2 + y2 | `rocket` | 🚀 | | `eyes` | 👀 | -⏫ [Back to list](#List) +[⏫ Back to list](#List) ### `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`. -⏫ [Back to list](#List) +[⏫ Back to list](#List) + ## Actions Template diff --git a/README.zh-CN.md b/README.zh-CN.md index e3cab6f..1809c89 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -266,6 +266,8 @@ ### ⭐ 基 础 + + 为了更好的展示功能,下面以实际场景举例,请灵活参考。 #### `add-assignees` @@ -308,7 +310,7 @@ jobs: - `assignees` 支持多个,需用逗号隔开 - assign 最多只能设定 10 个 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `add-labels` @@ -344,7 +346,7 @@ jobs: - `labels` 支持多个,需用逗号隔开 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `close-issue` @@ -366,7 +368,7 @@ jobs: | issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ | | close-reason | 关闭原因。默认`not_planned`未计划,`completed`完成 | string | ✖ | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `create-comment` @@ -410,7 +412,7 @@ jobs: - `${{ github.event.issue.user.login }}` 表示该 issue 的创建者 - `emoji` 支持多个,需用逗号隔开 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `create-issue` @@ -453,7 +455,7 @@ jobs: - `title` 为空时,无操作 - 返回 `issue-number`,[用法参考](#outputs-使用) -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `create-label` @@ -481,7 +483,7 @@ jobs: - `label-name`:若已存在,则无操作 - `label-color`:默认为 `ededed` -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `delete-comment` @@ -502,7 +504,7 @@ jobs: | token | [token 说明](#token) | string | ✖ | | comment-id | 指定的 comment | number | ✔ | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `get-issue` @@ -523,7 +525,7 @@ jobs: - 返回 `issue-number` `issue-title` `issue-body` `issue-labels` `issue-assignees` `issue-state`,[用法参考](#outputs-使用) -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `lock-issue` @@ -558,7 +560,7 @@ jobs: - `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam` -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `open-issue` @@ -579,7 +581,7 @@ jobs: | token | [token 说明](#token) | string | ✖ | | issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `remove-assignees` @@ -602,7 +604,7 @@ jobs: | issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ | | assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `remove-labels` @@ -627,7 +629,7 @@ jobs: - `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `set-labels` @@ -650,7 +652,7 @@ jobs: | issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ | | labels | labels 设置。当空字符时,会移除所有 | string | ✔ | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `unlock-issue` @@ -671,7 +673,7 @@ jobs: | token | [token 说明](#token) | string | ✖ | | issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `update-comment` @@ -711,7 +713,7 @@ jobs: - `body` 不填时,会保持原有 - `update-mode` 为 `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `update-issue` @@ -749,9 +751,11 @@ jobs: - `state` 默认为 `open` - 当可选项不填时,会保持原有 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) + ### 🌟 进 阶 + 进阶用法不建议 actions 多个一次同时使用。 @@ -802,7 +806,7 @@ jobs: - `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建 - `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `check-issue` @@ -844,7 +848,7 @@ jobs: - `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级 - 返回 `check-result`,由于 yml 原因,判断条件为 `if: steps.xxid.outputs.check-result == 'true'` -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `close-issues` @@ -891,7 +895,7 @@ jobs: - `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有 - `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `find-comments` @@ -929,7 +933,7 @@ jobs: - `direction` 默认为升序,只有设置 `desc` 时,会返回降序 - 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `find-issues` @@ -974,7 +978,7 @@ jobs: - 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0 - `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `lock-issues` @@ -1023,7 +1027,7 @@ jobs: - `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有 - `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `mark-assignees` @@ -1061,7 +1065,7 @@ jobs: - 普通用户为 `read` 权限 - 当设置 `write` 后,`admin` 和 `write` 满足条件 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `mark-duplicate` @@ -1107,7 +1111,7 @@ jobs: - 普通用户为 `read` 权限 - 当设置 `write` 后,`admin` 和 `write` 满足条件 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `toggle-labels` @@ -1140,7 +1144,7 @@ jobs: | issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ | | labels | 切换 labels。如果 label 已存在则删除,不存在则添加 | string | ✖ | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) #### `welcome` @@ -1180,9 +1184,11 @@ jobs: - 若这 4 个可选项都不填,则无操作 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) + ## 🎁 参 考 + ### token @@ -1197,14 +1203,14 @@ jobs: 当 actions 不填写 token 时,或填写 `${{ secrets.GITHUB_TOKEN }}`,会默认为 `github-actions-bot`。[更多查看](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)。 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) ### GitHub Docs - [GitHub Actions 语法](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows) - [工作流触发机制](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows) -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) ### `outputs` 使用 @@ -1224,7 +1230,7 @@ jobs: 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 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) ### 校验规则 @@ -1254,7 +1260,7 @@ x2 + y2 "x1" false ``` -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) ### emoji 类型 @@ -1269,13 +1275,14 @@ x2 + y2 | `rocket` | 🚀 | | `eyes` | 👀 | -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) ### `comment-id` 点击某个评论右上角 `···` 图标,选择 `Copy link`,url 末尾数字即是 `comment_id`。 -⏫ [返回列表](#列-表) +[⏫ 返回列表](#列-表) + ## Actions 模板 diff --git a/package.json b/package.json index 08dc393..829ec67 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@vercel/ncc": "0.34.0", "chalk": "^4.1.2", "common-tags": "^1.8.2", - "dumi": "^2.1.14", + "dumi": "^2.1.21", "eslint": "^7.18.0", "eslint-plugin-github": "^4.1.1", "eslint-plugin-simple-import-sort": "^7.0.0", diff --git a/web/.dumi/global.less b/web/.dumi/global.less index 5327337..59f2fc3 100644 --- a/web/.dumi/global.less +++ b/web/.dumi/global.less @@ -17,6 +17,11 @@ html { @{dark-selector} & { box-shadow: inset 0 0 10px 2px rgba(0, 0, 0, .8); } + + // https://github.com/actions-cool/issues-helper/pull/152#issuecomment-1504394017 + & + & { + margin-top: 16px; + } } diff --git a/web/.dumirc.ts b/web/.dumirc.ts index 0ca475e..47347b0 100644 --- a/web/.dumirc.ts +++ b/web/.dumirc.ts @@ -1,5 +1,7 @@ // more config: https://d.umijs.org/config import { defineConfig } from 'dumi'; +import path from 'path'; +import remarkPlugin from './remark-plugins'; const name = 'issues-helper'; @@ -20,6 +22,7 @@ export default defineConfig({ { id: 'zh-CN', name: '中文' }, ], favicons: [logo], + extraRemarkPlugins: [remarkPlugin], themeConfig: { logo, nav: { diff --git a/web/docs/advanced.md b/web/docs/advanced.md index 1941377..2aefd93 100644 --- a/web/docs/advanced.md +++ b/web/docs/advanced.md @@ -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 + diff --git a/web/docs/advanced.zh-CN.md b/web/docs/advanced.zh-CN.md index 9d199d4..b4169ef 100644 --- a/web/docs/advanced.zh-CN.md +++ b/web/docs/advanced.zh-CN.md @@ -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 个可选项都不填,则无操作 + diff --git a/web/docs/base.md b/web/docs/base.md index 78e0c0b..fbeea07 100644 --- a/web/docs/base.md +++ b/web/docs/base.md @@ -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 + diff --git a/web/docs/base.zh-CN.md b/web/docs/base.zh-CN.md index d4bce03..b671fc1 100644 --- a/web/docs/base.zh-CN.md +++ b/web/docs/base.zh-CN.md @@ -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` -- 当可选项不填时,会保持原有 + diff --git a/web/docs/guide/ref.md b/web/docs/guide/ref.md index 72dcad9..7908664 100644 --- a/web/docs/guide/ref.md +++ b/web/docs/guide/ref.md @@ -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`. + diff --git a/web/docs/guide/ref.zh-CN.md b/web/docs/guide/ref.zh-CN.md index 4c25a21..ac6f05f 100644 --- a/web/docs/guide/ref.zh-CN.md +++ b/web/docs/guide/ref.zh-CN.md @@ -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`。 + diff --git a/web/remark-plugins/index.ts b/web/remark-plugins/index.ts new file mode 100644 index 0000000..15e0b82 --- /dev/null +++ b/web/remark-plugins/index.ts @@ -0,0 +1,100 @@ +import { unistUtilVisit } from 'dumi'; + +const WRAPPER_OPEN_TAG = ' { + unistUtilVisit.visit(tree, 'html', (node, index, parent) => { + if (node.value.startsWith(WRAPPER_OPEN_TAG)) { + // get attributes + const attrMatch = node.value.match(/(\w+)=['"]([^'"]+)['"]/g); + + // convert attributes to object + const attrObj = attrMatch.reduce((acc, cur) => { + const split = cur.split('='); + const key = split[0].trim().replace(/['"]/g, ''); + const value = split[1].trim().replace(/['"]/g, ''); + + if (value.match(/^-?\d+$/)) { + acc[key] = Number(value); + } else { + acc[key] = value; + } + + return acc; + }, {}); + + // transform headings + const depth = Number.isInteger(attrObj['depth']) ? attrObj['depth'] : 0; + unistUtilVisit.visit(tree, 'heading', (node: any) => { + node.depth = node.depth - depth; + }); + + // transform links + unistUtilVisit.visit(tree, 'link', (node, index, parent) => { + /** + * remove blacktop link + * zh-CN: url="#列-表", en-US: url="#List" + */ + if (['#列-表', '#List'].includes(node.url)) { + if (parent && typeof index === 'number') { + parent.children.splice( + index, + 1, + // ...('children' in node ? node.children : []) // 不需要保留子节点 + ); + } + return unistUtilVisit.CONTINUE; + } + + /** + * redirect: + * 1. token 说明 + */ + if (node.url === '#token') { + node.url = `./guide/ref${node.url}`; + return unistUtilVisit.CONTINUE; + } + + if (['#emoji-类型', '#emoji-types'].includes(node.url)) { + node.url = `./guide/ref${node.url}`; + return unistUtilVisit.CONTINUE; + } + + if (node.url === '#github-docs') { + node.url = `./guide/ref${node.url}`; + return unistUtilVisit.CONTINUE; + } + + if (['#outputs-使用', '#outputs-use'].includes(node.url)) { + node.url = `./guide/ref${node.url}`; + return unistUtilVisit.CONTINUE; + } + + if (['#校验规则', '#check-rules'].includes(node.url)) { + node.url = `./guide/ref${node.url}`; + return unistUtilVisit.CONTINUE; + } + + if (node.url === '#comment-id') { + node.url = `./guide/ref${node.url}`; + return unistUtilVisit.CONTINUE; + } + }); + } + + if ( + (node.value === WRAPPER_CLOSE_TAG || node.value.startsWith(WRAPPER_OPEN_TAG)) && + parent && + typeof index === 'number' + ) { + if (parent && typeof index === 'number') { + parent.children.splice(index, 1); + } + } + }); + }; +} + +export default remarkPlugin;