feat: add toggle-labels action (#132)

* feat: add `toggle-labels` action

* docs: update docs

* chore: npm run package

* Revert "docs: update docs"

This reverts commit b08e8f300e.

* docs: update docs

* Update README.zh-CN.md

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>

* Update README.md

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>

* Update README.zh-CN.md

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>

* Update README.md

* move

* update

* lint code

* build

use npm run all

* update

* build

use npm run all

* chore: order

* update docs

* format code

use npm run format

* build

use npm run all

---------

Co-authored-by: xrkffgg <xrkffgg@vip.qq.com>
This commit is contained in:
Wuxh
2023-01-31 12:56:43 +08:00
committed by GitHub
parent f4eba4debf
commit 6a55b3a9f4
8 changed files with 193 additions and 2 deletions

View File

@@ -260,6 +260,7 @@
- [`mark-assignees`](#mark-assignees)
- [`mark-duplicate`](#mark-duplicate)
- [`welcome`](#welcome)
- [`toggle-labels`](#toggle-labels)
## 🚀 使 用
@@ -1148,6 +1149,39 @@ jobs:
⏫ [返回列表](#列-表)
#### `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 | ✖ |
⏫ [返回列表](#列-表)
## 🎁 参 考
### token