actions-ecosystem/action-add-labels
GitHub: actions-ecosystem/action-add-labels
一个用于在 GitHub Actions 工作流中自动为 issue 或 PR 添加标签的自动化组件。
Stars: 126 | Forks: 52
# Action 添加 Labels
[][actions-workflow-test]
[][release]
[][license]

这是一个 GitHub Action,用于为 issue 或 pull request 添加 GitHub 标签。
此 Action 默认会从触发它的 issue 或 pull request 中提取编号。
这意味着你不需要再为是使用 `${{ github.event.issue.number }}` 还是 `${{ github.event.pull_request.number }}` 这样的繁琐问题而烦恼。
与其他 GitHub Actions 的输出结合使用会更加实用。
## 输入参数
| 名称 | 描述 | 类型 | 必填 | 默认值 |
| -------------- | ----------------------------------------------------------------------------------------------- | -------- | -------- | ------------------------------------------------------------------------------- |
| `github_token` | 一个 GitHub token。 | `string` | `false` | `${{ github.token }}` |
| `labels` | 要添加的标签名称。如果有多个标签,必须使用换行符分隔。 | `string` | `true` | `N/A` |
| `number` | issue 或 pull request 的编号。 | `number` | `false` | `N/A` |
| `repo` | 所有者和仓库名称。例如:`Codertocat/Hello-World` | `string` | `false` | `${{ github.event.issue.number }}` 或 `${{ github.event.pull_request.number }}` |
## 示例
### 通过评论添加单个标签
```
name: Add Label
on:
issues:
types: opened
jobs:
add_label:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: add label
uses: actions-ecosystem/action-add-labels@v1
if: ${{ startsWith(github.event.comment.body, '/add-labels') }}
with:
labels: bug
```
### 通过评论添加多个标签
```
name: Add Labels
on:
pull_request:
types: opened
jobs:
add_labels:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: add labels
uses: actions-ecosystem/action-add-labels@v1
if: ${{ startsWith(github.event.comment.body, '/add-labels') }}
with:
labels: |
documentation
changelog
```
## 许可证
Copyright 2020 The Actions Ecosystem Authors.
Action Add Labels 基于 [Apache License 2.0](./LICENSE) 发布。
标签:GitHub Actions, MITM代理, SOC Prime, 开发工具, 数据可视化, 标签管理, 网络调试, 自动化, 自动化攻击, 自动笔记