Skip to content

Commit b527433

Browse files
authored
feat: add check-issue & remove labels (#12)
1 parent 62ec5c7 commit b527433

File tree

12 files changed

+449
-9
lines changed

12 files changed

+449
-9
lines changed

.env

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ yarn-debug.log*
1111
yarn-error.log*
1212

1313
# Private
14+
.env
1415

1516
# misc
1617
.DS_Store

README.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ English | [简体中文](./README.zh-CN.md)
66

77
A GitHub Action to help you manage issues
88

9+
Online documentation | [Changelog](./changelog.md)
10+
911
## 😎 Why use GitHub Action?
1012

1113
1. Complete free.
@@ -26,12 +28,14 @@ A GitHub Action to help you manage issues
2628
- [`lock-issue`](#lock-issue)
2729
- [`open-issue`](#open-issue)
2830
- [`remove-assignees`](#remove-assignees)
31+
- [`remove-labels`](#remove-labels)
2932
- [`set-labels`](#set-labels)
3033
- [`unlock-issue`](#unlock-issue)
3134
- [`update-comment`](#update-comment)
3235
- [`update-issue`](#update-issue)
3336
- ⭐ Advanced
3437
- [`check-inactive`](#check-inactive)
38+
- [`check-issue`](#check-issue)
3539
- [`close-issues`](#close-issues)
3640
- [`find-comments`](#find-comments)
3741
- [`lock-issues`](#lock-issues)
@@ -325,6 +329,31 @@ Remove the person designated by issue.
325329

326330
⏫ [Back to list](#List)
327331

332+
#### `remove-labels`
333+
334+
Remove the specified labels.
335+
336+
```yml
337+
- name: Remove labels
338+
uses: actions-cool/[email protected]
339+
with:
340+
actions: 'remove-labels'
341+
token: ${{ secrets.GITHUB_TOKEN }}
342+
issue-number: ${{ github.event.issue.number }}
343+
labels: 'xx'
344+
```
345+
346+
| Param | Desc | Type | Required | Version |
347+
| -- | -- | -- | -- | -- |
348+
| actions | Action type | string | ✔ | v1.2 |
349+
| token | [Token explain](#token) | string | ✔ | v1.2 |
350+
| issue-number | The number of issue | number | ✔ | v1.2 |
351+
| labels | The removed labels. When it is a blank character, do not remove | string | ✔ | v1.2 |
352+
353+
- `labels` supports multiple, such as `x1,x2,x3`, only the labels added by the issue will be removed
354+
355+
⏫ [Back to list](#List)
356+
328357
#### `set-labels`
329358

330359
Replace the labels of issue.
@@ -449,7 +478,7 @@ Update the specified issue according to the `issue-number`.
449478

450479
### ⭐ Advanced
451480

452-
It is not recommended to use multiple actions for advanced usage.
481+
Advanced usage is not recommended to use multiple actions at the same time.
453482

454483
#### `check-inactive`
455484

@@ -495,6 +524,60 @@ jobs:
495524
- `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
496525
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
497526

527+
⏫ [Back to list](#List)
528+
529+
#### `check-issue`
530+
531+
Check whether the issue meets the conditions according to the passed parameters and `issue-number`, and return a boolean value.
532+
533+
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. The conditions are as follows:
534+
535+
```
536+
x1 + y1
537+
x2 + y1
538+
x1 + y2
539+
x2 + y2
540+
541+
"x1y3y2" true
542+
"1x2y" false
543+
"y2 x1" true
544+
```
545+
546+
```yml
547+
name: Check Issue
548+
549+
on:
550+
issues:
551+
types: [edited]
552+
553+
jobs:
554+
check-issue:
555+
runs-on: ubuntu-latest
556+
steps:
557+
- name: check-issue
558+
uses: actions-cool/issues-helper@v1
559+
with:
560+
actions: 'check-issue'
561+
token: ${{ secrets.GITHUB_TOKEN }}
562+
issue-number: ${{ github.event.issue.number }}
563+
assignee-includes: 'x1,x2'
564+
title-includes: 'x1,x2/y1,y2'
565+
```
566+
567+
| Param | Desc | Type | Required | Version |
568+
| -- | -- | -- | -- | -- |
569+
| actions | Action type | string | ✔ | v1.2 |
570+
| token | [Token explain](#token) | string | ✔ | v1.2 |
571+
| issue-number | The number of issue | number | ✔ | v1.2 |
572+
| assignee-includes | Assignees contains check | string | ✔ | v1.2 |
573+
| title-includes | Title contains check | string | ✔ | v1.2 |
574+
| body-includes | Body contains check | string | ✔ | v1.2 |
575+
576+
- `title-includes` `body-includes` supports the format `x1,x2` or `x1,x2/y1,y2`. Only supports two levels
577+
- Return `check-result`
578+
579+
⏫ [Back to list](#List)
580+
498581
#### `close-issues`
499582

500583
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.

README.zh-CN.md

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
一个帮你管理 issues 的 GitHub Action
88

9+
在线文档 | [更新日志](./changelog.zh-CN.md)
10+
911
## 😎 为什么用 GitHub Action?
1012

1113
1. 完全免费。
@@ -26,12 +28,14 @@
2628
- [`lock-issue`](#lock-issue)
2729
- [`open-issue`](#open-issue)
2830
- [`remove-assignees`](#remove-assignees)
31+
- [`remove-labels`](#remove-labels)
2932
- [`set-labels`](#set-labels)
3033
- [`unlock-issue`](#unlock-issue)
3134
- [`update-comment`](#update-comment)
3235
- [`update-issue`](#update-issue)
3336
- ⭐ 进 阶
3437
- [`check-inactive`](#check-inactive)
38+
- [`check-issue`](#check-issue)
3539
- [`close-issues`](#close-issues)
3640
- [`find-comments`](#find-comments)
3741
- [`lock-issues`](#lock-issues)
@@ -325,6 +329,31 @@ jobs:
325329

326330
⏫ [返回列表](#列-表)
327331

332+
#### `remove-labels`
333+
334+
移除指定 labels。
335+
336+
```yml
337+
- name: Remove labels
338+
uses: actions-cool/[email protected]
339+
with:
340+
actions: 'remove-labels'
341+
token: ${{ secrets.GITHUB_TOKEN }}
342+
issue-number: ${{ github.event.issue.number }}
343+
labels: 'xx'
344+
```
345+
346+
| 参数 | 描述 | 类型 | 必填 | 版本 |
347+
| -- | -- | -- | -- | -- |
348+
| actions | 操作类型 | string | ✔ | v1.2 |
349+
| token | [token 说明](#token) | string | ✔ | v1.2 |
350+
| issue-number | 指定的 issue | number | ✔ | v1.2 |
351+
| labels | 移除的 labels。当为空字符时,不进行移除 | string | ✔ | v1.2 |
352+
353+
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
354+
355+
⏫ [返回列表](#列-表)
356+
328357
#### `set-labels`
329358

330359
替换 issue 的 labels。
@@ -449,7 +478,7 @@ jobs:
449478

450479
### ⭐ 进 阶
451480

452-
进阶用法不建议 actions 多重使用
481+
进阶用法不建议 actions 多个一次同时使用
453482

454483
#### `check-inactive`
455484

@@ -495,6 +524,60 @@ jobs:
495524
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
496525
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
497526

527+
⏫ [返回列表](#列-表)
528+
529+
#### `check-issue`
530+
531+
根据传入的参数和 `issue-number` 来检查该 issue 是否满足条件,返回一个布尔值。
532+
533+
下面的例子效果是:当 issue 新开时,校验当前 issue 指定人是否包含 `x1` 或者 `x2`,满足一个指定人即可校验通过,同时校验标题是否满足条件。条件如下:
534+
535+
```
536+
x1 + y1
537+
x2 + y1
538+
x1 + y2
539+
x2 + y2
540+
541+
"x1y3y2" true
542+
"1x2y" false
543+
"y2 x1" true
544+
```
545+
546+
```yml
547+
name: Check Issue
548+
549+
on:
550+
issues:
551+
types: [edited]
552+
553+
jobs:
554+
check-issue:
555+
runs-on: ubuntu-latest
556+
steps:
557+
- name: check-issue
558+
uses: actions-cool/issues-helper@v1
559+
with:
560+
actions: 'check-issue'
561+
token: ${{ secrets.GITHUB_TOKEN }}
562+
issue-number: ${{ github.event.issue.number }}
563+
assignee-includes: 'x1,x2'
564+
title-includes: 'x1,x2/y1,y2'
565+
```
566+
567+
| 参数 | 描述 | 类型 | 必填 | 版本 |
568+
| -- | -- | -- | -- | -- |
569+
| actions | 操作类型 | string || v1.2 |
570+
| token | [token 说明](#token) | string || v1.2 |
571+
| issue-number | 指定的 issue | number || v1.2 |
572+
| assignee-includes | 是否包含指定人 | string || v1.2 |
573+
| title-includes | 标题包含校验 | string || v1.2 |
574+
| body-includes | 内容包含校验 | string || v1.2 |
575+
576+
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
577+
- 返回 `check-result`
578+
579+
[返回列表](#列-表)
580+
498581
#### `close-issues`
499582

500583
每 7 天 UTC 0 时,关闭已填加 `need info` label 且 7 天以上未活跃的 issues。

action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: 'Issues Helper'
2-
description: 'Some operations on issue'
2+
description: 'A GitHub Action to help you manage issues'
33
author: 'xrkffgg'
44
branding:
55
icon: 'message-square'
6-
color: 'blue'
6+
color: 'black'
77
inputs:
88
actions:
99
description: 'Action name'
@@ -32,6 +32,8 @@ inputs:
3232
description: 'Find comments direction'
3333
comment-auth:
3434
description: 'Find comments query auth'
35+
assignee-includes:
36+
description: 'Check use'
3537
body-includes:
3638
description: 'Query use'
3739
title-includes:
@@ -55,6 +57,8 @@ outputs:
5557
description: 'Create comment ID'
5658
comments:
5759
description: 'Find comments'
60+
check-result:
61+
description: 'Check issue'
5862
runs:
5963
using: node12
6064
main: 'dist/index.js'

changelog.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ✨ Changelog
2+
3+
## Version rules
4+
5+
- Use two-level semantic version, such as v1, v1.1, v2, v2.1
6+
- v1 represents the initial version
7+
- The fixes and additions to the v1 version will be released to the v1.1 version
8+
- When the released v1.x runs stable for a certain period of time, release the advanced v2 version
9+
10+
## Version selection
11+
12+
- It is recommended to use the latest releases version. It can be seen in [releases](https://github.com/actions-cool/issues-helper/releases)
13+
14+
- You can also refer to the update log below to select the version
15+
16+
- It also supports the direct use of branch versions. Such as:
17+
18+
```yml
19+
- name: Issues Helper
20+
uses: actions-cool/issues-helper@main
21+
```
22+
23+
## Change Log
24+
25+
### v1.1
26+
27+
`2020.12.24`
28+
29+
- fix: yml not support array. [#11](https://github.com/actions-cool/issues-helper/pull/11)
30+
31+
### v1
32+
33+
`2020.12.23`
34+
35+
🎉 First release.

changelog.zh-CN.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ✨ 更新日志
2+
3+
## 版本规则
4+
5+
- 采用两级语义化版本,如v1、v1.1、v2、v2.1
6+
- v1 表示初始版本
7+
- 对 v1 版本的修复和新增会发布到 v1.1 版本
8+
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
9+
10+
## 版本选择
11+
12+
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
13+
14+
- 同时也可参照下面的更新日志来选择版本
15+
16+
- 也支持直接使用分支版本。如:
17+
18+
```yml
19+
- name: Issues Helper
20+
uses: actions-cool/issues-helper@main
21+
```
22+
23+
## 更新日志
24+
25+
### v1.1
26+
27+
`2020.12.24`
28+
29+
- fix: yml not support array. [#11](https://github.com/actions-cool/issues-helper/pull/11)
30+
31+
### v1
32+
33+
`2020.12.23`
34+
35+
🎉 First release.

0 commit comments

Comments
 (0)