mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-20 02:35:58 +08:00
Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
77e16f7f08 | ||
![]() |
26a4993608 | ||
![]() |
f3eb0a0a96 | ||
![]() |
a610082f8a | ||
![]() |
556cc4f66e | ||
![]() |
e0e6d4a469 | ||
![]() |
fac636e8a9 | ||
![]() |
a0d1612783 | ||
![]() |
49a9184d18 | ||
![]() |
5457ae8d7c | ||
![]() |
0071d48bea | ||
![]() |
25379ae1ea | ||
![]() |
9a2f8c1e68 | ||
![]() |
554782c560 | ||
![]() |
d5f2de3db2 | ||
![]() |
254683255c | ||
![]() |
0d51d36520 | ||
![]() |
635ca07363 | ||
![]() |
36a1dd8767 | ||
![]() |
5586509e90 | ||
![]() |
ecbe084012 | ||
![]() |
596892f346 | ||
![]() |
25313a56b2 | ||
![]() |
464f817556 | ||
![]() |
f2d552d67b | ||
![]() |
b363cba6ec | ||
![]() |
f3f91e4aa4 | ||
![]() |
65840f57fe | ||
![]() |
dbeaa215cb | ||
![]() |
6a55b3a9f4 | ||
![]() |
f4eba4debf | ||
![]() |
09bc8811a0 | ||
![]() |
dfac87c369 |
3
.github/workflows/ci-notice.yml
vendored
3
.github/workflows/ci-notice.yml
vendored
@@ -8,6 +8,9 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [14.x]
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@@ -5,6 +5,9 @@ on: [push, pull_request]
|
|||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [20.x]
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@main
|
uses: actions/checkout@main
|
||||||
|
3
.github/workflows/gh-pages.yml
vendored
3
.github/workflows/gh-pages.yml
vendored
@@ -8,6 +8,9 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [16.x]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: yarn
|
- run: yarn
|
||||||
|
6
.github/workflows/preview-build.yml
vendored
6
.github/workflows/preview-build.yml
vendored
@@ -16,13 +16,13 @@ jobs:
|
|||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
yarn
|
yarn
|
||||||
yarn docs-dev:build
|
yarn docs:preview
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
zip -r dist.zip docs-dist
|
zip -r dist.zip docs-dist
|
||||||
|
|
||||||
- name: upload dist artifact
|
- name: upload dist artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist.zip
|
path: dist.zip
|
||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload PR number
|
- name: Upload PR number
|
||||||
if: ${{ always() }}
|
if: ${{ always() }}
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: pr
|
name: pr
|
||||||
path: ./pr-id.txt
|
path: ./pr-id.txt
|
||||||
|
6
.github/workflows/preview-deploy.yml
vendored
6
.github/workflows/preview-deploy.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
||||||
steps:
|
steps:
|
||||||
- name: download pr artifact
|
- name: download pr artifact
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: dawidd6/action-download-artifact@v6
|
||||||
with:
|
with:
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
name: pr
|
name: pr
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
run: echo "::set-output name=id::$(<pr-id.txt)"
|
run: echo "::set-output name=id::$(<pr-id.txt)"
|
||||||
|
|
||||||
- name: download dist artifact
|
- name: download dist artifact
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: dawidd6/action-download-artifact@v6
|
||||||
with:
|
with:
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
@@ -69,7 +69,7 @@ jobs:
|
|||||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure'
|
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure'
|
||||||
steps:
|
steps:
|
||||||
- name: download pr artifact
|
- name: download pr artifact
|
||||||
uses: dawidd6/action-download-artifact@v2
|
uses: dawidd6/action-download-artifact@v6
|
||||||
with:
|
with:
|
||||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||||
name: pr
|
name: pr
|
||||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -47,6 +47,11 @@ package-lock.json
|
|||||||
.umi-test
|
.umi-test
|
||||||
.env.local
|
.env.local
|
||||||
|
|
||||||
|
# dumi
|
||||||
|
web/.dumi/tmp
|
||||||
|
web/.dumi/tmp-test
|
||||||
|
web/.dumi/tmp-production
|
||||||
|
|
||||||
# cache
|
# cache
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
|
|
||||||
|
31
CHANGELOG.md
31
CHANGELOG.md
@@ -7,6 +7,37 @@
|
|||||||
🛠 refactor
|
🛠 refactor
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## v3.6.0
|
||||||
|
|
||||||
|
`2024.02.18`
|
||||||
|
|
||||||
|
- 🚀 feat: add assignees to find-issues. [#192](https://github.com/actions-cool/issues-helper/pull/192)
|
||||||
|
- 💄 chore: Bump runtime to node20. [#190](https://github.com/actions-cool/issues-helper/pull/190) [@danielcompton](https://github.com/danielcompton)
|
||||||
|
|
||||||
|
## v3.5.2
|
||||||
|
|
||||||
|
`2023.08.16`
|
||||||
|
|
||||||
|
- 🐞 fix: return `issue-assignees` in the correct output field for `get-issue`. [#163](https://github.com/actions-cool/issues-helper/pull/163) [@misund](https://github.com/misund)
|
||||||
|
|
||||||
|
## v3.5.1
|
||||||
|
|
||||||
|
`2023.07.27`
|
||||||
|
|
||||||
|
- 💄 perf: `inactive-mode` support `issue-created` `comment-created`.
|
||||||
|
|
||||||
|
## v3.5.0
|
||||||
|
|
||||||
|
`2023.07.19`
|
||||||
|
|
||||||
|
- 🚀 feat: support `inactive-mode`. Optional `comment`, which will check the last comment update time. [#158](https://github.com/actions-cool/issues-helper/pull/158)
|
||||||
|
|
||||||
|
## v3.4.0
|
||||||
|
|
||||||
|
`2023.02.06`
|
||||||
|
|
||||||
|
- 🚀 feat: support `toggle-labels`. [#132](https://github.com/actions-cool/issues-helper/pull/132) [@Wxh16144](https://github.com/Wxh16144)
|
||||||
|
|
||||||
## v3.3.3
|
## v3.3.3
|
||||||
|
|
||||||
`2022.11.13`
|
`2022.11.13`
|
||||||
|
123
README.md
123
README.md
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
A GitHub Action that easily helps you automatically manage issues
|
A GitHub Action that easily helps you automatically manage issues
|
||||||
|
|
||||||
[](https://github.com/actions-cool/issues-helper/actions)
|
[](https://github.com/actions-cool/issues-helper/actions)
|
||||||
[](https://github.com/marketplace/actions/issues-helper)
|
[](https://github.com/marketplace/actions/issues-helper)
|
||||||

|

|
||||||
[](https://github.com/umijs/dumi)
|
[](https://github.com/umijs/dumi)
|
||||||
@@ -116,7 +116,7 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
|
|||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
<a href="https://github.com/TuSimple/naive-ui">
|
<a href="https://github.com/TuSimple/naive-ui">
|
||||||
<img src="https://camo.githubusercontent.com/b8ebecade711b9ae1fa306e7a1c9dd680fb56b0e2b9f015fec9cbad343570353/68747470733a2f2f6e6169766575692e6f73732d636e2d686f6e676b6f6e672e616c6979756e63732e636f6d2f6e616976656c6f676f2e737667" width="46"/>
|
<img src="https://www.naiveui.com/assets/naivelogo-XQ1U1Js8.svg" width="46"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -255,11 +255,13 @@ When the following list does not have the features you want, you can submit it i
|
|||||||
- [`lock-issues`](#lock-issues)
|
- [`lock-issues`](#lock-issues)
|
||||||
- [`mark-assignees`](#mark-assignees)
|
- [`mark-assignees`](#mark-assignees)
|
||||||
- [`mark-duplicate`](#mark-duplicate)
|
- [`mark-duplicate`](#mark-duplicate)
|
||||||
|
- [`toggle-labels`](#toggle-labels)
|
||||||
- [`welcome`](#welcome)
|
- [`welcome`](#welcome)
|
||||||
|
|
||||||
## 🚀 Usage
|
## 🚀 Usage
|
||||||
|
|
||||||
### ⭐ Base
|
### ⭐ Base
|
||||||
|
<wrapper base data-depth="2" data-warn="DO_NOT_REMOVE_THIS_COMMENT">
|
||||||
|
|
||||||
In order to better display the function, the following is an example of the actual scene, please refer to it flexibly.
|
In order to better display the function, the following is an example of the actual scene, please refer to it flexibly.
|
||||||
|
|
||||||
@@ -303,7 +305,7 @@ jobs:
|
|||||||
- `assignees` support multiple and separated by comma
|
- `assignees` support multiple and separated by comma
|
||||||
- You can assign up to 10 people to each issue
|
- You can assign up to 10 people to each issue
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `add-labels`
|
#### `add-labels`
|
||||||
|
|
||||||
@@ -339,7 +341,7 @@ jobs:
|
|||||||
|
|
||||||
- `labels` support multiple and separated by comma
|
- `labels` support multiple and separated by comma
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `close-issue`
|
#### `close-issue`
|
||||||
|
|
||||||
@@ -361,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 | ✖ |
|
| 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 | ✖ |
|
| close-reason | Reason for closing. Default `not_planned`, another `completed` | string | ✖ |
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `create-comment`
|
#### `create-comment`
|
||||||
|
|
||||||
@@ -405,7 +407,7 @@ jobs:
|
|||||||
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
|
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
|
||||||
- `emoji` support multiple and separated by comma
|
- `emoji` support multiple and separated by comma
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `create-issue`
|
#### `create-issue`
|
||||||
|
|
||||||
@@ -448,7 +450,7 @@ jobs:
|
|||||||
- No action when `title` is empty
|
- No action when `title` is empty
|
||||||
- Return `issue-number`. [Usage reference](#outputs-use)
|
- Return `issue-number`. [Usage reference](#outputs-use)
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `create-label`
|
#### `create-label`
|
||||||
|
|
||||||
@@ -476,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-name`: If it already exists, no operation
|
||||||
- `label-color`: Default is `ededed`
|
- `label-color`: Default is `ededed`
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `delete-comment`
|
#### `delete-comment`
|
||||||
|
|
||||||
@@ -497,7 +499,7 @@ According to [`comment-id`](#comment-id) delete the specified comment.
|
|||||||
| token | [Token explain](#token) | string | ✖ |
|
| token | [Token explain](#token) | string | ✖ |
|
||||||
| comment-id | The comment ID | number | ✔ |
|
| comment-id | The comment ID | number | ✔ |
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `get-issue`
|
#### `get-issue`
|
||||||
|
|
||||||
@@ -518,7 +520,7 @@ Query issue information.
|
|||||||
|
|
||||||
- Return `issue-number` `issue-title` `issue-body` `issue-labels` `issue-assignees` `issue-state`. [Usage reference](#outputs-use)
|
- 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`
|
#### `lock-issue`
|
||||||
|
|
||||||
@@ -553,7 +555,7 @@ jobs:
|
|||||||
|
|
||||||
- `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam`
|
- `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam`
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `open-issue`
|
#### `open-issue`
|
||||||
|
|
||||||
@@ -574,7 +576,7 @@ Open the specified issue.
|
|||||||
| token | [Token explain](#token) | string | ✖ |
|
| token | [Token explain](#token) | string | ✖ |
|
||||||
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
|
| 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`
|
#### `remove-assignees`
|
||||||
|
|
||||||
@@ -597,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 | ✖ |
|
| 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 | ✔ |
|
| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ |
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `remove-labels`
|
#### `remove-labels`
|
||||||
|
|
||||||
@@ -622,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
|
- `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`
|
#### `set-labels`
|
||||||
|
|
||||||
@@ -645,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 | ✖ |
|
| 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 | ✔ |
|
| labels | labels set. When empty characters, will remove all | string | ✔ |
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `unlock-issue`
|
#### `unlock-issue`
|
||||||
|
|
||||||
@@ -666,7 +668,7 @@ Unlock the specified issue.
|
|||||||
| token | [Token explain](#token) | string | ✖ |
|
| token | [Token explain](#token) | string | ✖ |
|
||||||
| issue-number | The number of issue. When not input, it will be obtained from the trigger event | number | ✖ |
|
| 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`
|
#### `update-comment`
|
||||||
|
|
||||||
@@ -707,7 +709,7 @@ jobs:
|
|||||||
- When `body` is not entered, it will remain as it is
|
- 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 `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`
|
#### `update-issue`
|
||||||
|
|
||||||
@@ -745,9 +747,11 @@ Update the specified issue according to the `issue-number`.
|
|||||||
- `state` defaults to `open`
|
- `state` defaults to `open`
|
||||||
- When the option is not filled, it will keep the original
|
- When the option is not filled, it will keep the original
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
</wrapper>
|
||||||
|
|
||||||
### 🌟 Advanced
|
### 🌟 Advanced
|
||||||
|
<wrapper advanced data-depth="2" data-warn="DO_NOT_REMOVE_THIS_COMMENT">
|
||||||
|
|
||||||
Advanced usage is not recommended to use multiple actions at the same time.
|
Advanced usage is not recommended to use multiple actions at the same time.
|
||||||
|
|
||||||
@@ -788,6 +792,7 @@ jobs:
|
|||||||
| body-includes | Body filtering | string | ✖ |
|
| body-includes | Body filtering | string | ✖ |
|
||||||
| title-includes | Title filtering | string | ✖ |
|
| title-includes | Title filtering | string | ✖ |
|
||||||
| inactive-day | Inactive days filtering | number | ✖ |
|
| inactive-day | Inactive days filtering | number | ✖ |
|
||||||
|
| inactive-mode | Detect inactive mode, default `issue` | string | ✖ |
|
||||||
| inactive-label | The label name adding | string | ✖ |
|
| inactive-label | The label name adding | string | ✖ |
|
||||||
| exclude-labels | Exclude labels filtering | string | ✖ |
|
| exclude-labels | Exclude labels filtering | string | ✖ |
|
||||||
|
|
||||||
@@ -797,8 +802,15 @@ jobs:
|
|||||||
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
|
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
|
||||||
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
|
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
|
||||||
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
|
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
|
||||||
|
- `inactive-mode`:
|
||||||
|
- Default `issue`: the issue updated time
|
||||||
|
- Optional `comment`: the last comment update time
|
||||||
|
- Optional `issue-created`: the issue created time
|
||||||
|
- Optional `comment-created`: the comment creation time
|
||||||
|
- You can also set multiple such as: `comment, issue-created`
|
||||||
|
- It will be detected with priority, the update time of the last comment will be detected first, if there is no comment, the creation time of the issue will be used
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `check-issue`
|
#### `check-issue`
|
||||||
|
|
||||||
@@ -806,9 +818,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`.
|
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.
|
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)
|
||||||
|
|
||||||
[Check rules](#check-rules)
|
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
name: Check Issue
|
name: Check Issue
|
||||||
@@ -844,7 +854,7 @@ jobs:
|
|||||||
- `title-includes` `body-includes` supports the format `x1,x2` or `x1,x2/y1,y2`. Only supports two levels
|
- `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'`
|
- 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`
|
#### `close-issues`
|
||||||
|
|
||||||
@@ -891,7 +901,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
|
- `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
|
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `find-comments`
|
#### `find-comments`
|
||||||
|
|
||||||
@@ -929,7 +939,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
|
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
|
||||||
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
|
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `find-issues`
|
#### `find-issues`
|
||||||
|
|
||||||
@@ -965,16 +975,17 @@ Find the current repository, the creator is k , the title contains `this` , the
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
[
|
[
|
||||||
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', created: '', updated: ''},
|
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', created: '', updated: ''},
|
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- `issue-state`: The default is `open`. Other values are: `closed`, `all`
|
||||||
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
|
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
|
||||||
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
|
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
|
||||||
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
|
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `lock-issues`
|
#### `lock-issues`
|
||||||
|
|
||||||
@@ -1023,7 +1034,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
|
- `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
|
- `exclude-labels`: When set to include `$exclude-empty`, no label issue can be excluded
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `mark-assignees`
|
#### `mark-assignees`
|
||||||
|
|
||||||
@@ -1061,7 +1072,7 @@ jobs:
|
|||||||
- Ordinary users have `read` permission
|
- Ordinary users have `read` permission
|
||||||
- When set `write`, `admin` and `write` meet the conditions
|
- When set `write`, `admin` and `write` meet the conditions
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `mark-duplicate`
|
#### `mark-duplicate`
|
||||||
|
|
||||||
@@ -1107,7 +1118,40 @@ jobs:
|
|||||||
- Ordinary users have `read` permission
|
- Ordinary users have `read` permission
|
||||||
- When set `write`, `admin` and `write` meet the conditions
|
- When set `write`, `admin` and `write` meet the conditions
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
|
#### `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](#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 | ✖ |
|
||||||
|
|
||||||
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
#### `welcome`
|
#### `welcome`
|
||||||
|
|
||||||
@@ -1148,9 +1192,11 @@ jobs:
|
|||||||
|
|
||||||
- If these 4 options are not filled, no operation
|
- If these 4 options are not filled, no operation
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
</wrapper>
|
||||||
|
|
||||||
## 🎁 Reference
|
## 🎁 Reference
|
||||||
|
<wrapper reference data-depth="1" data-warn="DO_NOT_REMOVE_THIS_COMMENT">
|
||||||
|
|
||||||
### token
|
### token
|
||||||
|
|
||||||
@@ -1165,14 +1211,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).
|
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
|
### GitHub Docs
|
||||||
|
|
||||||
- [Workflow syntax for GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
|
- [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)
|
- [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
|
### `outputs` use
|
||||||
|
|
||||||
@@ -1192,7 +1238,7 @@ More:
|
|||||||
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
|
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
|
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
|
### Check rules
|
||||||
|
|
||||||
@@ -1222,7 +1268,7 @@ x2 + y2
|
|||||||
"x1" false
|
"x1" false
|
||||||
```
|
```
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
### Emoji types
|
### Emoji types
|
||||||
|
|
||||||
| content | emoji |
|
| content | emoji |
|
||||||
@@ -1236,13 +1282,14 @@ x2 + y2
|
|||||||
| `rocket` | 🚀 |
|
| `rocket` | 🚀 |
|
||||||
| `eyes` | 👀 |
|
| `eyes` | 👀 |
|
||||||
|
|
||||||
⏫ [Back to list](#List)
|
[⏫ Back to list](#List)
|
||||||
|
|
||||||
### `comment-id`
|
### `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`.
|
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)
|
||||||
|
</wrapper>
|
||||||
|
|
||||||
## Actions Template
|
## Actions Template
|
||||||
|
|
||||||
|
119
README.zh-CN.md
119
README.zh-CN.md
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
一个轻松帮你自动管理 issues 的 GitHub Action
|
一个轻松帮你自动管理 issues 的 GitHub Action
|
||||||
|
|
||||||
[](https://github.com/actions-cool/issues-helper/actions)
|
[](https://github.com/actions-cool/issues-helper/actions)
|
||||||
[](https://github.com/marketplace/actions/issues-helper)
|
[](https://github.com/marketplace/actions/issues-helper)
|
||||||

|

|
||||||
[](https://github.com/umijs/dumi)
|
[](https://github.com/umijs/dumi)
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td align="center" width="180">
|
<td align="center" width="180">
|
||||||
<a href="https://github.com/TuSimple/naive-ui">
|
<a href="https://github.com/TuSimple/naive-ui">
|
||||||
<img src="https://camo.githubusercontent.com/b8ebecade711b9ae1fa306e7a1c9dd680fb56b0e2b9f015fec9cbad343570353/68747470733a2f2f6e6169766575692e6f73732d636e2d686f6e676b6f6e672e616c6979756e63732e636f6d2f6e616976656c6f676f2e737667" width="46"/>
|
<img src="https://www.naiveui.com/assets/naivelogo-XQ1U1Js8.svg" width="46"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -259,12 +259,15 @@
|
|||||||
- [`lock-issues`](#lock-issues)
|
- [`lock-issues`](#lock-issues)
|
||||||
- [`mark-assignees`](#mark-assignees)
|
- [`mark-assignees`](#mark-assignees)
|
||||||
- [`mark-duplicate`](#mark-duplicate)
|
- [`mark-duplicate`](#mark-duplicate)
|
||||||
|
- [`toggle-labels`](#toggle-labels)
|
||||||
- [`welcome`](#welcome)
|
- [`welcome`](#welcome)
|
||||||
|
|
||||||
## 🚀 使 用
|
## 🚀 使 用
|
||||||
|
|
||||||
### ⭐ 基 础
|
### ⭐ 基 础
|
||||||
|
|
||||||
|
<wrapper base data-depth="2" data-warn="DO_NOT_REMOVE_THIS_COMMENT">
|
||||||
|
|
||||||
为了更好的展示功能,下面以实际场景举例,请灵活参考。
|
为了更好的展示功能,下面以实际场景举例,请灵活参考。
|
||||||
|
|
||||||
#### `add-assignees`
|
#### `add-assignees`
|
||||||
@@ -307,7 +310,7 @@ jobs:
|
|||||||
- `assignees` 支持多个,需用逗号隔开
|
- `assignees` 支持多个,需用逗号隔开
|
||||||
- assign 最多只能设定 10 个
|
- assign 最多只能设定 10 个
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `add-labels`
|
#### `add-labels`
|
||||||
|
|
||||||
@@ -343,7 +346,7 @@ jobs:
|
|||||||
|
|
||||||
- `labels` 支持多个,需用逗号隔开
|
- `labels` 支持多个,需用逗号隔开
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `close-issue`
|
#### `close-issue`
|
||||||
|
|
||||||
@@ -365,7 +368,7 @@ jobs:
|
|||||||
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
||||||
| close-reason | 关闭原因。默认`not_planned`未计划,`completed`完成 | string | ✖ |
|
| close-reason | 关闭原因。默认`not_planned`未计划,`completed`完成 | string | ✖ |
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `create-comment`
|
#### `create-comment`
|
||||||
|
|
||||||
@@ -409,7 +412,7 @@ jobs:
|
|||||||
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
|
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
|
||||||
- `emoji` 支持多个,需用逗号隔开
|
- `emoji` 支持多个,需用逗号隔开
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `create-issue`
|
#### `create-issue`
|
||||||
|
|
||||||
@@ -452,7 +455,7 @@ jobs:
|
|||||||
- `title` 为空时,无操作
|
- `title` 为空时,无操作
|
||||||
- 返回 `issue-number`,[用法参考](#outputs-使用)
|
- 返回 `issue-number`,[用法参考](#outputs-使用)
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `create-label`
|
#### `create-label`
|
||||||
|
|
||||||
@@ -480,7 +483,7 @@ jobs:
|
|||||||
- `label-name`:若已存在,则无操作
|
- `label-name`:若已存在,则无操作
|
||||||
- `label-color`:默认为 `ededed`
|
- `label-color`:默认为 `ededed`
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `delete-comment`
|
#### `delete-comment`
|
||||||
|
|
||||||
@@ -501,7 +504,7 @@ jobs:
|
|||||||
| token | [token 说明](#token) | string | ✖ |
|
| token | [token 说明](#token) | string | ✖ |
|
||||||
| comment-id | 指定的 comment | number | ✔ |
|
| comment-id | 指定的 comment | number | ✔ |
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `get-issue`
|
#### `get-issue`
|
||||||
|
|
||||||
@@ -522,7 +525,7 @@ jobs:
|
|||||||
|
|
||||||
- 返回 `issue-number` `issue-title` `issue-body` `issue-labels` `issue-assignees` `issue-state`,[用法参考](#outputs-使用)
|
- 返回 `issue-number` `issue-title` `issue-body` `issue-labels` `issue-assignees` `issue-state`,[用法参考](#outputs-使用)
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `lock-issue`
|
#### `lock-issue`
|
||||||
|
|
||||||
@@ -557,7 +560,7 @@ jobs:
|
|||||||
|
|
||||||
- `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam`
|
- `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam`
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `open-issue`
|
#### `open-issue`
|
||||||
|
|
||||||
@@ -578,7 +581,7 @@ jobs:
|
|||||||
| token | [token 说明](#token) | string | ✖ |
|
| token | [token 说明](#token) | string | ✖ |
|
||||||
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `remove-assignees`
|
#### `remove-assignees`
|
||||||
|
|
||||||
@@ -601,7 +604,7 @@ jobs:
|
|||||||
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
||||||
| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ |
|
| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ |
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `remove-labels`
|
#### `remove-labels`
|
||||||
|
|
||||||
@@ -626,7 +629,7 @@ jobs:
|
|||||||
|
|
||||||
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
|
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `set-labels`
|
#### `set-labels`
|
||||||
|
|
||||||
@@ -649,7 +652,7 @@ jobs:
|
|||||||
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
||||||
| labels | labels 设置。当空字符时,会移除所有 | string | ✔ |
|
| labels | labels 设置。当空字符时,会移除所有 | string | ✔ |
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `unlock-issue`
|
#### `unlock-issue`
|
||||||
|
|
||||||
@@ -670,7 +673,7 @@ jobs:
|
|||||||
| token | [token 说明](#token) | string | ✖ |
|
| token | [token 说明](#token) | string | ✖ |
|
||||||
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `update-comment`
|
#### `update-comment`
|
||||||
|
|
||||||
@@ -710,7 +713,7 @@ jobs:
|
|||||||
- `body` 不填时,会保持原有
|
- `body` 不填时,会保持原有
|
||||||
- `update-mode` 为 `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
|
- `update-mode` 为 `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `update-issue`
|
#### `update-issue`
|
||||||
|
|
||||||
@@ -748,9 +751,11 @@ jobs:
|
|||||||
- `state` 默认为 `open`
|
- `state` 默认为 `open`
|
||||||
- 当可选项不填时,会保持原有
|
- 当可选项不填时,会保持原有
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
</wrapper>
|
||||||
|
|
||||||
### 🌟 进 阶
|
### 🌟 进 阶
|
||||||
|
<wrapper advanced data-depth="2" data-warn="DO_NOT_REMOVE_THIS_COMMENT">
|
||||||
|
|
||||||
进阶用法不建议 actions 多个一次同时使用。
|
进阶用法不建议 actions 多个一次同时使用。
|
||||||
|
|
||||||
@@ -791,6 +796,7 @@ jobs:
|
|||||||
| body-includes | 包含内容筛选 | string | ✖ |
|
| body-includes | 包含内容筛选 | string | ✖ |
|
||||||
| title-includes | 包含标题筛选 | string | ✖ |
|
| title-includes | 包含标题筛选 | string | ✖ |
|
||||||
| inactive-day | 非活跃天数筛选 | number | ✖ |
|
| inactive-day | 非活跃天数筛选 | number | ✖ |
|
||||||
|
| inactive-mode | 检测不活跃的模式 | string | ✖ |
|
||||||
| inactive-label | 新增标签名称 | string | ✖ |
|
| inactive-label | 新增标签名称 | string | ✖ |
|
||||||
| exclude-labels | 排除标签筛选 | string | ✖ |
|
| exclude-labels | 排除标签筛选 | string | ✖ |
|
||||||
|
|
||||||
@@ -800,8 +806,15 @@ jobs:
|
|||||||
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
|
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
|
||||||
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
|
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
|
||||||
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
||||||
|
- `inactive-mode`:
|
||||||
|
- 默认 `issue`,检查 issue 的更新时间
|
||||||
|
- 可选 `comment`,检查最后一个评论的更新时间
|
||||||
|
- 可选 `issue-created`,检查 issue 的创建时间
|
||||||
|
- 可选 `comment-created`,最后一个评论的创建时间
|
||||||
|
- 你也可以设置多个如:`comment, issue-created`
|
||||||
|
- 将会以优先级检测,先检测最后一条评论更新时间,如无评论,则使用 issue 的创建时间
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `check-issue`
|
#### `check-issue`
|
||||||
|
|
||||||
@@ -843,7 +856,7 @@ jobs:
|
|||||||
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
|
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
|
||||||
- 返回 `check-result`,由于 yml 原因,判断条件为 `if: steps.xxid.outputs.check-result == 'true'`
|
- 返回 `check-result`,由于 yml 原因,判断条件为 `if: steps.xxid.outputs.check-result == 'true'`
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `close-issues`
|
#### `close-issues`
|
||||||
|
|
||||||
@@ -890,7 +903,7 @@ jobs:
|
|||||||
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
|
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
|
||||||
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `find-comments`
|
#### `find-comments`
|
||||||
|
|
||||||
@@ -928,7 +941,7 @@ jobs:
|
|||||||
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
|
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
|
||||||
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
|
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `find-issues`
|
#### `find-issues`
|
||||||
|
|
||||||
@@ -964,8 +977,8 @@ jobs:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
[
|
[
|
||||||
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', created: '', updated: ''},
|
{number: 1, auth: 'x', body: 'xxx', body: 'xxx', state: 'open', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', created: '', updated: ''},
|
{number: 2, auth: 'x', body: 'xxx', body: 'xxx', state: 'closed', assignees: ['x1', 'x2'], created: '', updated: ''},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -973,7 +986,7 @@ jobs:
|
|||||||
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
|
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
|
||||||
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `lock-issues`
|
#### `lock-issues`
|
||||||
|
|
||||||
@@ -1022,7 +1035,7 @@ jobs:
|
|||||||
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
|
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
|
||||||
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
- `exclude-labels`:设置包含 `$exclude-empty` 时,可排除无 label issue
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `mark-assignees`
|
#### `mark-assignees`
|
||||||
|
|
||||||
@@ -1060,7 +1073,7 @@ jobs:
|
|||||||
- 普通用户为 `read` 权限
|
- 普通用户为 `read` 权限
|
||||||
- 当设置 `write` 后,`admin` 和 `write` 满足条件
|
- 当设置 `write` 后,`admin` 和 `write` 满足条件
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `mark-duplicate`
|
#### `mark-duplicate`
|
||||||
|
|
||||||
@@ -1106,7 +1119,40 @@ jobs:
|
|||||||
- 普通用户为 `read` 权限
|
- 普通用户为 `read` 权限
|
||||||
- 当设置 `write` 后,`admin` 和 `write` 满足条件
|
- 当设置 `write` 后,`admin` 和 `write` 满足条件
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
|
#### `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 说明](#token) | string | ✖ |
|
||||||
|
| issue-number | 指定的 issue,当不传时会从触发事件中获取 | number | ✖ |
|
||||||
|
| labels | 切换 labels。如果 label 已存在则删除,不存在则添加 | string | ✖ |
|
||||||
|
|
||||||
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
#### `welcome`
|
#### `welcome`
|
||||||
|
|
||||||
@@ -1146,9 +1192,11 @@ jobs:
|
|||||||
|
|
||||||
- 若这 4 个可选项都不填,则无操作
|
- 若这 4 个可选项都不填,则无操作
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
</wrapper>
|
||||||
|
|
||||||
## 🎁 参 考
|
## 🎁 参 考
|
||||||
|
<wrapper reference data-depth="1" data-warn="DO_NOT_REMOVE_THIS_COMMENT">
|
||||||
|
|
||||||
### token
|
### token
|
||||||
|
|
||||||
@@ -1163,14 +1211,14 @@ jobs:
|
|||||||
|
|
||||||
当 actions 不填写 token 时,或填写 `${{ secrets.GITHUB_TOKEN }}`,会默认为 `github-actions-bot`。[更多查看](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)。
|
当 actions 不填写 token 时,或填写 `${{ secrets.GITHUB_TOKEN }}`,会默认为 `github-actions-bot`。[更多查看](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)。
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
### GitHub Docs
|
### GitHub Docs
|
||||||
|
|
||||||
- [GitHub Actions 语法](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#about-yaml-syntax-for-workflows)
|
- [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)
|
- [工作流触发机制](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
### `outputs` 使用
|
### `outputs` 使用
|
||||||
|
|
||||||
@@ -1190,7 +1238,7 @@ jobs:
|
|||||||
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
|
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
|
2. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
### 校验规则
|
### 校验规则
|
||||||
|
|
||||||
@@ -1220,7 +1268,7 @@ x2 + y2
|
|||||||
"x1" false
|
"x1" false
|
||||||
```
|
```
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
### emoji 类型
|
### emoji 类型
|
||||||
|
|
||||||
@@ -1235,13 +1283,14 @@ x2 + y2
|
|||||||
| `rocket` | 🚀 |
|
| `rocket` | 🚀 |
|
||||||
| `eyes` | 👀 |
|
| `eyes` | 👀 |
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
|
||||||
### `comment-id`
|
### `comment-id`
|
||||||
|
|
||||||
点击某个评论右上角 `···` 图标,选择 `Copy link`,url 末尾数字即是 `comment_id`。
|
点击某个评论右上角 `···` 图标,选择 `Copy link`,url 末尾数字即是 `comment_id`。
|
||||||
|
|
||||||
⏫ [返回列表](#列-表)
|
[⏫ 返回列表](#列-表)
|
||||||
|
</wrapper>
|
||||||
|
|
||||||
## Actions 模板
|
## Actions 模板
|
||||||
|
|
||||||
|
2
USERS.js
2
USERS.js
@@ -77,7 +77,7 @@ const users = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: 'https://github.com/TuSimple/naive-ui',
|
url: 'https://github.com/TuSimple/naive-ui',
|
||||||
logo: 'https://camo.githubusercontent.com/b8ebecade711b9ae1fa306e7a1c9dd680fb56b0e2b9f015fec9cbad343570353/68747470733a2f2f6e6169766575692e6f73732d636e2d686f6e676b6f6e672e616c6979756e63732e636f6d2f6e616976656c6f676f2e737667',
|
logo: 'https://www.naiveui.com/assets/naivelogo-XQ1U1Js8.svg',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: 'https://github.com/element-plus/element-plus',
|
url: 'https://github.com/element-plus/element-plus',
|
||||||
|
@@ -75,6 +75,8 @@ inputs:
|
|||||||
description: 'Query use'
|
description: 'Query use'
|
||||||
inactive-day:
|
inactive-day:
|
||||||
description: 'Query use'
|
description: 'Query use'
|
||||||
|
inactive-mode:
|
||||||
|
description: 'Inactive mode'
|
||||||
lock-reason:
|
lock-reason:
|
||||||
description: 'The reason lock issue'
|
description: 'The reason lock issue'
|
||||||
inactive-label:
|
inactive-label:
|
||||||
@@ -117,5 +119,5 @@ outputs:
|
|||||||
description: 'Check issue'
|
description: 'Check issue'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node16
|
using: node20
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
843
dist/index.js
vendored
843
dist/index.js
vendored
File diff suppressed because one or more lines are too long
21
package.json
21
package.json
@@ -14,12 +14,14 @@
|
|||||||
"docs:build": "APP_ROOT=web dumi build",
|
"docs:build": "APP_ROOT=web dumi build",
|
||||||
"docs-dev:build": "APP_ROOT=web UMI_ENV=dev dumi build",
|
"docs-dev:build": "APP_ROOT=web UMI_ENV=dev dumi build",
|
||||||
"docs:deploy": "gh-pages -d docs-dist",
|
"docs:deploy": "gh-pages -d docs-dist",
|
||||||
"deploy": "npm run docs:build && npm run docs:deploy",
|
"docs:preview": "PREVIEW=true npm run docs:build",
|
||||||
|
"gh-pages": "npm run docs:build && npm run docs:deploy",
|
||||||
"format": "prettier --write **/*.ts **/*/*.ts",
|
"format": "prettier --write **/*.ts **/*/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts **/*/*.ts",
|
"format-check": "prettier --check **/*.ts **/*/*.ts",
|
||||||
"lint": "eslint src/*.ts src/*/*.ts",
|
"lint": "eslint src/*.ts src/*/*.ts",
|
||||||
"lint-fix": "eslint src/*.ts src/*/*.ts --fix",
|
"lint-fix": "eslint src/*.ts src/*/*.ts --fix",
|
||||||
"lint-up": "npm run format && npm run lint-fix",
|
"lint-up": "npm run format && npm run lint-fix",
|
||||||
|
"ci:fix": "npm run lint-up",
|
||||||
"lint-all": "npm run format-check && npm run lint",
|
"lint-all": "npm run format-check && npm run lint",
|
||||||
"check-commit": "node ./scripts/check-commit.js",
|
"check-commit": "node ./scripts/check-commit.js",
|
||||||
"tag": "node ./scripts/tag.js",
|
"tag": "node ./scripts/tag.js",
|
||||||
@@ -44,19 +46,22 @@
|
|||||||
"@types/lodash": "^4.14.175",
|
"@types/lodash": "^4.14.175",
|
||||||
"@typescript-eslint/parser": "^4.15.2",
|
"@typescript-eslint/parser": "^4.15.2",
|
||||||
"@umijs/fabric": "^2.5.6",
|
"@umijs/fabric": "^2.5.6",
|
||||||
"@vercel/ncc": "^0.27.0",
|
"@vercel/ncc": "0.34.0",
|
||||||
"common-tags": "^1.8.2",
|
|
||||||
"dumi": "^1.1.26",
|
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
"new-github-release-url": "^1.0.0",
|
"common-tags": "^1.8.2",
|
||||||
"open": "^7.3.0",
|
"dumi": "^2.1.21",
|
||||||
"eslint": "^7.18.0",
|
"eslint": "^7.18.0",
|
||||||
"eslint-plugin-github": "^4.1.1",
|
"eslint-plugin-github": "^4.1.1",
|
||||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||||
"father": "^2.30.7",
|
"father": "^2.30.7",
|
||||||
"gh-pages": "^3.1.0",
|
"gh-pages": "^3.1.0",
|
||||||
|
"new-github-release-url": "^1.0.0",
|
||||||
|
"open": "^7.3.0",
|
||||||
"prettier": "^2.2.1",
|
"prettier": "^2.2.1",
|
||||||
"typescript": "^4.1.3",
|
"simple-git": "^2.46.0",
|
||||||
"simple-git": "^2.46.0"
|
"typescript": "^4.1.3"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"types-ramda": "0.29.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -38,6 +38,7 @@ async function run() {
|
|||||||
if (tags.includes(tagSimple)) {
|
if (tags.includes(tagSimple)) {
|
||||||
console.log(chalk.yellow(`[Git Action] Delete ${tagSimple} tag`));
|
console.log(chalk.yellow(`[Git Action] Delete ${tagSimple} tag`));
|
||||||
execSync(`git push origin :refs/tags/${tagSimple}`);
|
execSync(`git push origin :refs/tags/${tagSimple}`);
|
||||||
|
console.log(chalk.green(`[Git Action] Delete ${tagSimple} tag success`));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(chalk.yellow(`[Git Action] Add new simple ${tagSimple} tag`));
|
console.log(chalk.yellow(`[Git Action] Add new simple ${tagSimple} tag`));
|
||||||
|
@@ -16,6 +16,7 @@ import {
|
|||||||
doCreateComment,
|
doCreateComment,
|
||||||
doCreateCommentEmoji,
|
doCreateCommentEmoji,
|
||||||
doLockIssue,
|
doLockIssue,
|
||||||
|
doRemoveLabels,
|
||||||
doSetLabels,
|
doSetLabels,
|
||||||
doUpdateComment,
|
doUpdateComment,
|
||||||
} from './base';
|
} from './base';
|
||||||
@@ -58,7 +59,7 @@ export async function doQueryIssues(
|
|||||||
const titleIncludes = core.getInput('title-includes');
|
const titleIncludes = core.getInput('title-includes');
|
||||||
|
|
||||||
const excludeLabelsArr = dealStringToArr(excludeLabels);
|
const excludeLabelsArr = dealStringToArr(excludeLabels);
|
||||||
issuesList.forEach(issue => {
|
issuesList.forEach(async issue => {
|
||||||
const bodyCheck = bodyIncludes ? issue.body.includes(bodyIncludes) : true;
|
const bodyCheck = bodyIncludes ? issue.body.includes(bodyIncludes) : true;
|
||||||
const titleCheck = titleIncludes ? issue.title.includes(titleIncludes) : true;
|
const titleCheck = titleIncludes ? issue.title.includes(titleIncludes) : true;
|
||||||
/**
|
/**
|
||||||
@@ -83,8 +84,33 @@ export async function doQueryIssues(
|
|||||||
dayjs.extend(isSameOrBefore);
|
dayjs.extend(isSameOrBefore);
|
||||||
|
|
||||||
const lastTime = dayjs.utc().subtract(+inactiveDay, 'day');
|
const lastTime = dayjs.utc().subtract(+inactiveDay, 'day');
|
||||||
const updateTime = dayjs.utc(issue.updated_at);
|
|
||||||
if (updateTime.isSameOrBefore(lastTime)) {
|
const inactiveMode = dealStringToArr(core.getInput('inactive-mode'));
|
||||||
|
let checkTime: dayjs.Dayjs | null = null;
|
||||||
|
|
||||||
|
for (const mode of inactiveMode) {
|
||||||
|
if (checkTime) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mode === 'comment' || mode === 'comment-created') {
|
||||||
|
ICE.setIssueNumber(issue.number);
|
||||||
|
const comments = await ICE.listComments();
|
||||||
|
if (comments.length) {
|
||||||
|
checkTime = dayjs.utc(
|
||||||
|
comments[comments.length - 1][mode === 'comment' ? 'updated_at' : 'created_at'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode === 'issue-created') {
|
||||||
|
checkTime = dayjs.utc(issue.created_at);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!checkTime) {
|
||||||
|
checkTime = dayjs.utc(issue.updated_at);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkTime && checkTime.isSameOrBefore(lastTime)) {
|
||||||
issues.push(issue);
|
issues.push(issue);
|
||||||
issueNumbers.push(issue.number);
|
issueNumbers.push(issue.number);
|
||||||
}
|
}
|
||||||
@@ -246,6 +272,7 @@ export async function doFindIssues() {
|
|||||||
title: issue.title,
|
title: issue.title,
|
||||||
body: issue.body,
|
body: issue.body,
|
||||||
state: issue.state,
|
state: issue.state,
|
||||||
|
assignees: issue.assignees.map(val => val.login),
|
||||||
created: issue.created_at,
|
created: issue.created_at,
|
||||||
updated: issue.updated_at,
|
updated: issue.updated_at,
|
||||||
};
|
};
|
||||||
@@ -361,6 +388,32 @@ export async function doMarkDuplicate(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function doToggleLabels(labels: string[] = []) {
|
||||||
|
const issue = await ICE.getIssue();
|
||||||
|
const baseLabels: string[] = issue.labels.map(({ name }: any) => name);
|
||||||
|
|
||||||
|
const addLabels = [];
|
||||||
|
const removeLabels = [];
|
||||||
|
|
||||||
|
for (const label of labels) {
|
||||||
|
if (baseLabels.includes(label)) {
|
||||||
|
removeLabels.push(label);
|
||||||
|
} else {
|
||||||
|
addLabels.push(label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removeLabels.length) {
|
||||||
|
await doRemoveLabels(removeLabels);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addLabels.length) {
|
||||||
|
await doAddLabels(addLabels);
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info(`[doToggleLabels] Done!`);
|
||||||
|
}
|
||||||
|
|
||||||
export async function doWelcome(
|
export async function doWelcome(
|
||||||
auth: string,
|
auth: string,
|
||||||
issueNumber: number,
|
issueNumber: number,
|
||||||
|
@@ -74,8 +74,8 @@ export async function doCreateIssue(
|
|||||||
|
|
||||||
export async function doCreateLabel() {
|
export async function doCreateLabel() {
|
||||||
const name = core.getInput('label-name');
|
const name = core.getInput('label-name');
|
||||||
const color = core.getInput('label-color') || 'ededed';
|
const color = core.getInput('label-color');
|
||||||
const description = core.getInput('label-desc') || '';
|
const description = core.getInput('label-desc');
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
await ICE.createLabel(name, color, description);
|
await ICE.createLabel(name, color, description);
|
||||||
@@ -104,7 +104,7 @@ export async function doGetIssue() {
|
|||||||
const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : '';
|
const labelsString = labels.length ? labels.map(({ name }) => name).join(',') : '';
|
||||||
core.setOutput('issue-labels', labelsString);
|
core.setOutput('issue-labels', labelsString);
|
||||||
const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : '';
|
const assigneesString = assignees.length ? assignees.map(({ login }) => login).join(',') : '';
|
||||||
core.setOutput('issue-body', assigneesString);
|
core.setOutput('issue-assignees', assigneesString);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function doLockIssue(issueNumber?: number) {
|
export async function doLockIssue(issueNumber?: number) {
|
||||||
|
@@ -14,6 +14,7 @@ import {
|
|||||||
doLockIssues,
|
doLockIssues,
|
||||||
doMarkAssignees,
|
doMarkAssignees,
|
||||||
doMarkDuplicate,
|
doMarkDuplicate,
|
||||||
|
doToggleLabels,
|
||||||
doWelcome,
|
doWelcome,
|
||||||
initAdvancedICE,
|
initAdvancedICE,
|
||||||
} from './advanced';
|
} from './advanced';
|
||||||
@@ -79,8 +80,6 @@ export class IssueHelperEngine implements IIssueHelperEngine {
|
|||||||
const issueNumber = core.getInput('issue-number') || defaultCtxNumber;
|
const issueNumber = core.getInput('issue-number') || defaultCtxNumber;
|
||||||
if (issueNumber) {
|
if (issueNumber) {
|
||||||
this.issueNumber = +issueNumber;
|
this.issueNumber = +issueNumber;
|
||||||
} else {
|
|
||||||
core.warning(`'issue-number' is missing or this action not needed yet!`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emoji = core.getInput('emoji') || '';
|
this.emoji = core.getInput('emoji') || '';
|
||||||
@@ -251,6 +250,10 @@ export class IssueHelperEngine implements IIssueHelperEngine {
|
|||||||
await doMarkDuplicate(ctx.payload.comment as TCommentInfo, closeReason, labels, emoji);
|
await doMarkDuplicate(ctx.payload.comment as TCommentInfo, closeReason, labels, emoji);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'toggle-labels': {
|
||||||
|
await doToggleLabels(labels);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'welcome': {
|
case 'welcome': {
|
||||||
if (ctx.eventName === 'issues' && ctx.payload.action === 'opened') {
|
if (ctx.eventName === 'issues' && ctx.payload.action === 'opened') {
|
||||||
await doWelcome(ctx.actor, issueNumber, body, labels, assignees, emoji);
|
await doWelcome(ctx.actor, issueNumber, body, labels, assignees, emoji);
|
||||||
|
@@ -130,8 +130,8 @@ export class IssueCoreEngine implements IIssueCoreEngine {
|
|||||||
|
|
||||||
public async createLabel(
|
public async createLabel(
|
||||||
labelName: string,
|
labelName: string,
|
||||||
labelColor: string,
|
labelColor: string = 'ededed',
|
||||||
labelDescription: string | undefined,
|
labelDescription: string = '',
|
||||||
) {
|
) {
|
||||||
const { owner, repo, octokit } = this;
|
const { owner, repo, octokit } = this;
|
||||||
await octokit.issues.createLabel({
|
await octokit.issues.createLabel({
|
||||||
@@ -318,11 +318,19 @@ export class IssueCoreEngine implements IIssueCoreEngine {
|
|||||||
state: baseState,
|
state: baseState,
|
||||||
} = issue;
|
} = issue;
|
||||||
|
|
||||||
const baseLabelsName = baseLabels.map(({ name }: any) => name);
|
const baseLabelsName = baseLabels.map(({ name }) => name);
|
||||||
const baseAssignessName = baseAssigness?.map(({ login }: any) => login);
|
const baseAssignessName = baseAssigness?.map(({ login }) => login);
|
||||||
|
|
||||||
const newBody = body ? (mode === 'append' ? `${baseBody}\n${body}` : body) : baseBody;
|
const newBody = body ? (mode === 'append' ? `${baseBody}\n${body}` : body) : baseBody;
|
||||||
|
|
||||||
|
if (labels && labels.length) {
|
||||||
|
for (const label of labels) {
|
||||||
|
if (baseLabelsName && baseLabelsName.length && baseLabelsName.indexOf(label) < 0) {
|
||||||
|
await this.createLabel(label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await octokit.issues.update({
|
await octokit.issues.update({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
|
@@ -83,7 +83,7 @@ export interface IIssueCoreEngine {
|
|||||||
createIssueEmoji: (emoji: TEmoji[]) => Promise<void>;
|
createIssueEmoji: (emoji: TEmoji[]) => Promise<void>;
|
||||||
createLabel: (
|
createLabel: (
|
||||||
labelName: string,
|
labelName: string,
|
||||||
labelColor: string,
|
labelColor: string | undefined,
|
||||||
labelDescription: string | undefined,
|
labelDescription: string | undefined,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
|
|
||||||
|
@@ -56,5 +56,6 @@ export type TAction =
|
|||||||
| 'lock-issues'
|
| 'lock-issues'
|
||||||
| 'mark-assignees'
|
| 'mark-assignees'
|
||||||
| 'mark-duplicate'
|
| 'mark-duplicate'
|
||||||
|
| 'toggle-labels'
|
||||||
| 'welcome';
|
| 'welcome';
|
||||||
//// [ Advanced End ]
|
//// [ Advanced End ]
|
||||||
|
File diff suppressed because one or more lines are too long
47
web/.dumirc.ts
Normal file
47
web/.dumirc.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
// more config: https://d.umijs.org/config
|
||||||
|
import { defineConfig } from 'dumi';
|
||||||
|
import path from 'path';
|
||||||
|
import remarkPlugin from './remark-plugins';
|
||||||
|
|
||||||
|
const name = 'issues-helper';
|
||||||
|
|
||||||
|
const isProdSite =
|
||||||
|
// 不是预览模式 同时是生产环境
|
||||||
|
process.env.PREVIEW !== 'true' && process.env.NODE_ENV === 'production';
|
||||||
|
|
||||||
|
const logo =
|
||||||
|
'https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*8xDgSL-O6O4AAAAAAAAAAAAAARQnAQ';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
title: 'Issues Helper',
|
||||||
|
outputPath: '../docs-dist',
|
||||||
|
base: isProdSite ? `/${name}/` : '/',
|
||||||
|
publicPath: isProdSite ? `/${name}/` : '/',
|
||||||
|
locales: [
|
||||||
|
{ id: 'en-US', name: 'English', },
|
||||||
|
{ id: 'zh-CN', name: '中文' },
|
||||||
|
],
|
||||||
|
favicons: [logo],
|
||||||
|
extraRemarkPlugins: [remarkPlugin],
|
||||||
|
themeConfig: {
|
||||||
|
logo,
|
||||||
|
nav: {
|
||||||
|
'zh-CN': [
|
||||||
|
{ title: '指 南', link: '/zh-CN/guide' },
|
||||||
|
{ title: '基 础', link: '/zh-CN/base' },
|
||||||
|
{ title: '进 阶', link: '/zh-CN/advanced' },
|
||||||
|
{ title: '更新日志', link: '/zh-CN/changelog' }
|
||||||
|
],
|
||||||
|
'en-US': [
|
||||||
|
{ title: 'Guide', link: '/guide' },
|
||||||
|
{ title: 'Base', link: '/base' },
|
||||||
|
{ title: 'Advanced', link: '/advanced' },
|
||||||
|
{ title: 'Changelog', link: '/changelog' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
socialLinks: {
|
||||||
|
github: 'https://github.com/actions-cool/issues-helper'
|
||||||
|
},
|
||||||
|
footer: 'Open-source MIT Licensed | Copyright © 2020-present<br />Powered by xrkffgg'
|
||||||
|
},
|
||||||
|
});
|
@@ -1,4 +0,0 @@
|
|||||||
export default {
|
|
||||||
base: '/',
|
|
||||||
publicPath: '/',
|
|
||||||
};
|
|
@@ -1,84 +0,0 @@
|
|||||||
// more config: https://d.umijs.org/config
|
|
||||||
import { defineConfig } from 'dumi';
|
|
||||||
|
|
||||||
const name = 'issues-helper';
|
|
||||||
|
|
||||||
const logo =
|
|
||||||
'https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*8xDgSL-O6O4AAAAAAAAAAAAAARQnAQ';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
title: 'Issues Helper',
|
|
||||||
mode: 'site',
|
|
||||||
favicon: logo,
|
|
||||||
logo,
|
|
||||||
exportStatic: {},
|
|
||||||
ssr: {},
|
|
||||||
outputPath: '../docs-dist',
|
|
||||||
resolve: {
|
|
||||||
includes: ['./docs'],
|
|
||||||
},
|
|
||||||
hash: true,
|
|
||||||
base: `/${name}/`,
|
|
||||||
publicPath: `/${name}/`,
|
|
||||||
locales: [
|
|
||||||
['en-US', 'English'],
|
|
||||||
['zh-CN', '中文'],
|
|
||||||
],
|
|
||||||
theme: {
|
|
||||||
'@c-primary': '#1890ff',
|
|
||||||
},
|
|
||||||
navs: {
|
|
||||||
'en-US': [
|
|
||||||
{ title: 'Guide', path: '/guide' },
|
|
||||||
{ title: 'Base', path: '/base' },
|
|
||||||
{ title: 'Advanced', path: '/advanced' },
|
|
||||||
{ title: 'Changelog', path: '/changelog' },
|
|
||||||
{ title: 'GitHub', path: 'https://github.com/actions-cool/issues-helper' },
|
|
||||||
],
|
|
||||||
'zh-CN': [
|
|
||||||
{ title: '指 南', path: '/zh-CN/guide' },
|
|
||||||
{ title: '基 础', path: '/zh-CN/base' },
|
|
||||||
{ title: '进 阶', path: '/zh-CN/advanced' },
|
|
||||||
{ title: '更新日志', path: '/zh-CN/changelog' },
|
|
||||||
{ title: 'GitHub', path: 'https://github.com/actions-cool/issues-helper' },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
menus: {
|
|
||||||
'/guide': [
|
|
||||||
{
|
|
||||||
title: '🍭 Guide',
|
|
||||||
children: ['/guide/index', '/guide/start'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '🎁 Reference',
|
|
||||||
path: '/guide/ref',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '🎗 Note',
|
|
||||||
path: '/guide/note',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '💬 FAQ',
|
|
||||||
path: '/guide/faq',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'/zh-CN/guide': [
|
|
||||||
{
|
|
||||||
title: '🍭 介 绍',
|
|
||||||
children: ['/guide/index', '/guide/start'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '🎁 参 考',
|
|
||||||
path: '/guide/ref',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '🎗 记 录',
|
|
||||||
path: '/guide/note',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '💬 FAQ',
|
|
||||||
path: '/guide/faq',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
@@ -1,2 +0,0 @@
|
|||||||
// For dumi style
|
|
||||||
import './web.less';
|
|
@@ -1,391 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 🌟 Advanced
|
||||||
---
|
---
|
||||||
|
|
||||||
# 🌟 Advanced
|
<embed src="../../README.md#RE-/<wrapper advanced [^>]*>([\s\S]*?)<\/wrapper>/"></embed>
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
<Alert>
|
|
||||||
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.
|
|
||||||
</Alert>
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## `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
|
|
||||||
|
@@ -1,386 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 🌟 进 阶
|
||||||
---
|
---
|
||||||
|
|
||||||
# 🌟 进 阶
|
<embed src="../../README.zh-CN.md#RE-/<wrapper advanced [^>]*>([\s\S]*?)<\/wrapper>/"></embed>
|
||||||
|
|
||||||
进阶用法不建议 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` 满足条件
|
|
||||||
|
|
||||||
<Alert>
|
|
||||||
注意:使用简洁命令创建的 Duplicate 不显示下图红框内容。但其实这个没有任何影响的。
|
|
||||||
</Alert>
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## `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 个可选项都不填,则无操作
|
|
||||||
|
459
web/docs/base.md
459
web/docs/base.md
@@ -1,460 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: ⭐ Base
|
||||||
---
|
---
|
||||||
|
|
||||||
# ⭐ Base
|
<embed src="../../README.md#RE-/<wrapper base [^>]*>([\s\S]*?)<\/wrapper>/"></embed>
|
||||||
|
|
||||||
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
|
|
||||||
|
@@ -1,460 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: ⭐ 基 础
|
||||||
---
|
---
|
||||||
|
|
||||||
为了更好的展示功能,下面以实际场景举例,请灵活参考。
|
<embed src="../../README.zh-CN.md#RE-/<wrapper base [^>]*>([\s\S]*?)<\/wrapper>/"></embed>
|
||||||
|
|
||||||
# ⭐ 基 础
|
|
||||||
|
|
||||||
## `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`
|
|
||||||
- 当可选项不填时,会保持原有
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 💬 FAQ
|
||||||
---
|
---
|
||||||
|
|
||||||
## Is there a charge for this feature?
|
## Is there a charge for this feature?
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 💬 FAQ
|
||||||
---
|
---
|
||||||
|
|
||||||
## 该功能是否收费?
|
## 该功能是否收费?
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
## Introduction
|
---
|
||||||
|
title: 🍭 Guide
|
||||||
|
---
|
||||||
|
|
||||||
The Issues Helper is a GitHub Action that easily helps you automatically manage issues.
|
The Issues Helper is a GitHub Action that easily helps you automatically manage issues.
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
## 介 绍
|
---
|
||||||
|
title: 🍭 介 绍
|
||||||
|
---
|
||||||
|
|
||||||
Issues 助手是一个轻松帮你自动管理 issues 的 GitHub Action。
|
Issues 助手是一个轻松帮你自动管理 issues 的 GitHub Action。
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 🎗 Note
|
||||||
---
|
---
|
||||||
|
|
||||||
<Alert type="success">
|
:::success{title="😊"}
|
||||||
Here are some things I summarized in my use, I hope it can help you.
|
Here are some things I summarized in my use, I hope it can help you.
|
||||||
</Alert>
|
:::
|
||||||
|
|
||||||
## Include judgment in `yml`
|
## Include judgment in `yml`
|
||||||
|
|
||||||
@@ -23,10 +23,10 @@ if: contains(github.event.issue.body, 'ie') == false
|
|||||||
with:
|
with:
|
||||||
actions: 'month-statistics'
|
actions: 'month-statistics'
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
count-lables: 'true'
|
count-labels: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
- `count-lables`: Regardless of setting `true` or `'ture'`, all received in the program is in string format
|
- `count-labels`: Regardless of setting `true` or `'ture'`, all received in the program is in string format
|
||||||
|
|
||||||
At the same time, the output is also in string format. [See](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs).
|
At the same time, the output is also in string format. [See](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs).
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 🎗 记 录
|
||||||
---
|
---
|
||||||
|
|
||||||
<Alert type="success">
|
:::success{title="😊"}
|
||||||
这里记录自己在使用中总结的一些东西,希望可以帮助到你。
|
这里记录自己在使用中总结的一些东西,希望可以帮助到你。
|
||||||
</Alert>
|
:::
|
||||||
|
|
||||||
## `yml` 中包含判断
|
## `yml` 中包含判断
|
||||||
|
|
||||||
@@ -24,10 +24,10 @@ if: contains(github.event.issue.body, 'ie') == false
|
|||||||
with:
|
with:
|
||||||
actions: 'month-statistics'
|
actions: 'month-statistics'
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
count-lables: 'true'
|
count-labels: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
- `count-lables`:不管设置 `true` 还是 `'ture'`,在程序里接收到的都是字符串格式
|
- `count-labels`:不管设置 `true` 还是 `'ture'`,在程序里接收到的都是字符串格式
|
||||||
|
|
||||||
同时输出的也是字符串格式。[参看](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs)。
|
同时输出的也是字符串格式。[参看](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs)。
|
||||||
|
|
||||||
|
@@ -1,86 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 🎁 Reference
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📍 `token`
|
<embed src="../../../README.md#RE-/<wrapper reference [^>]*>([\s\S]*?)<\/wrapper>/"></embed>
|
||||||
|
|
||||||
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`.
|
|
||||||
|
@@ -1,86 +1,5 @@
|
|||||||
---
|
---
|
||||||
toc: menu
|
title: 🎁 参 考
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📍 `token` 说明
|
<embed src="../../../README.zh-CN.md#RE-/<wrapper reference [^>]*>([\s\S]*?)<\/wrapper>/"></embed>
|
||||||
|
|
||||||
需拥有 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`。
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
## Quick start
|
---
|
||||||
|
title: ⚡️ Quick start
|
||||||
|
---
|
||||||
|
|
||||||
### 1. New Action
|
### 1. New Action
|
||||||
|
|
||||||
@@ -10,9 +12,9 @@ Click `New workflow` to add.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
<Alert type="success">
|
:::success{title="Tips"}
|
||||||
You can click <Badge>set up a workflow yourself</Badge> to add a custom action, or you can apply a new action based on a template. <a target="_blank" href="https://github.com/actions-cool/.github">Templates</a>.
|
You can click <Badge>set up a workflow yourself</Badge> to add a custom action, or you can apply a new action based on a template. <a target="_blank" href="https://github.com/actions-cool/.github">Templates</a>.
|
||||||
</Alert>
|
:::
|
||||||
|
|
||||||
### 2. Edit Action
|
### 2. Edit Action
|
||||||
|
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
## 快速开始
|
---
|
||||||
|
title: ⚡️ 快速开始
|
||||||
|
---
|
||||||
|
|
||||||
### 1. 新建 Action
|
### 1. 新建 Action
|
||||||
|
|
||||||
@@ -10,9 +12,9 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
<Alert type="success">
|
:::success{title="提示"}
|
||||||
你可以点击 <Badge>set up a workflow yourself</Badge> 新增一个自定义 action,也可以根据模板来套用新增一个 action。<a target="_blank" href="https://github.com/actions-cool/.github">模板使用</a>。
|
你可以点击 <Badge>set up a workflow yourself</Badge> 新增一个自定义 action,也可以根据模板来套用新增一个 action。<a target="_blank" href="https://github.com/actions-cool/.github">模板使用</a>。
|
||||||
</Alert>
|
:::
|
||||||
|
|
||||||
### 2. 编写 Action
|
### 2. 编写 Action
|
||||||
|
|
||||||
|
@@ -3,22 +3,20 @@ title: Issues Helper
|
|||||||
order: 1
|
order: 1
|
||||||
hero:
|
hero:
|
||||||
title: Issues Helper
|
title: Issues Helper
|
||||||
image: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*8xDgSL-O6O4AAAAAAAAAAAAAARQnAQ
|
description: 🤖 A GitHub Action that easily helps you automatically manage issues
|
||||||
desc: 🤖 A GitHub Action that easily helps you automatically manage issues
|
|
||||||
actions:
|
actions:
|
||||||
- text: Quick start
|
- text: Quick start
|
||||||
link: /guide/start
|
link: /guide/start
|
||||||
features:
|
features:
|
||||||
- icon: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*Km0BQJs7vWAAAAAAAAAAAAAAARQnAQ
|
- emoji: 🎁
|
||||||
title: Completely free
|
title: Completely free
|
||||||
desc: Use the Actions service provided by GitHub
|
description: Use the Actions service provided by GitHub
|
||||||
- icon: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*ELKWSIMizH0AAAAAAAAAAAAAARQnAQ
|
- emoji: 👌
|
||||||
title: Easy to use
|
title: Easy to use
|
||||||
desc: Detailed tutorials and rich templates
|
description: Detailed tutorials and rich templates
|
||||||
- icon: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*j-SURo-DkyIAAAAAAAAAAAAAARQnAQ
|
- emoji: 🌍
|
||||||
title: Easy hosting
|
title: Easy hosting
|
||||||
desc: As long as GitHub is not down, it will not be affected
|
description: As long as GitHub is not down, it will not be affected
|
||||||
footer: Open-source MIT Licensed | Copyright © 2020-present<br />Powered by xrkffgg
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🍭 Get started quickly
|
## 🍭 Get started quickly
|
||||||
|
@@ -3,22 +3,20 @@ title: Issues 助手
|
|||||||
order: 1
|
order: 1
|
||||||
hero:
|
hero:
|
||||||
title: Issues 助手
|
title: Issues 助手
|
||||||
image: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*8xDgSL-O6O4AAAAAAAAAAAAAARQnAQ
|
description: 🤖 一个轻松帮你自动管理 issues 的 GitHub Action
|
||||||
desc: 🤖 一个轻松帮你自动管理 issues 的 GitHub Action
|
|
||||||
actions:
|
actions:
|
||||||
- text: 快速开始
|
- text: 快速开始
|
||||||
link: /zh-CN/guide/start
|
link: /zh-CN/guide/start
|
||||||
features:
|
features:
|
||||||
- icon: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*Km0BQJs7vWAAAAAAAAAAAAAAARQnAQ
|
- emoji: 🎁
|
||||||
title: 完全免费
|
title: 完全免费
|
||||||
desc: 使用 GitHub 自带提供的 Actions 服务
|
description: 使用 GitHub 自带提供的 Actions 服务
|
||||||
- icon: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*ELKWSIMizH0AAAAAAAAAAAAAARQnAQ
|
- emoji: 👌
|
||||||
title: 简单易用
|
title: 简单易用
|
||||||
desc: 教程详细,模版丰富
|
description: 教程详细,模版丰富
|
||||||
- icon: https://gw.alipayobjects.com/mdn/rms_f97235/afts/img/A*j-SURo-DkyIAAAAAAAAAAAAAARQnAQ
|
- emoji: 🌍
|
||||||
title: 轻松托管
|
title: 轻松托管
|
||||||
desc: 只要 GitHub 不宕机,它就不受影响
|
description: 只要 GitHub 不宕机,它就不受影响
|
||||||
footer: Open-source MIT Licensed | Copyright © 2020-present<br />Powered by xrkffgg
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🍭 快速上手
|
## 🍭 快速上手
|
||||||
|
100
web/remark-plugins/index.ts
Normal file
100
web/remark-plugins/index.ts
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
import { unistUtilVisit } from 'dumi';
|
||||||
|
|
||||||
|
const WRAPPER_OPEN_TAG = '<wrapper';
|
||||||
|
const WRAPPER_CLOSE_TAG = '</wrapper>';
|
||||||
|
|
||||||
|
function remarkPlugin(opt) {
|
||||||
|
return (tree, vFile) => {
|
||||||
|
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;
|
Reference in New Issue
Block a user