Skip to content

Commit fac0bb5

Browse files
authored
feat: doQueryIssues title/body-includes support multiple value (#215)
1 parent 82e9b39 commit fac0bb5

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,8 @@ jobs:
789789
| issue-assignee | Assignee filtering | string | ✖ |
790790
| issue-creator | Creator filtering | string | ✖ |
791791
| issue-mentioned | Mentioned filtering | string | ✖ |
792-
| body-includes | Body filtering | string | ✖ |
793-
| title-includes | Title filtering | string | ✖ |
792+
| body-includes | Body filtering, supports filtering of multiple strings | string | ✖ |
793+
| title-includes | Title filtering, supports filtering of multiple strings | string | ✖ |
794794
| inactive-day | Inactive days filtering | number | ✖ |
795795
| inactive-mode | Detect inactive mode, default `issue` | string | ✖ |
796796
| inactive-label | The label name adding | string | ✖ |
@@ -891,8 +891,8 @@ jobs:
891891
| issue-assignee | Assignee filtering | string | ✖ |
892892
| issue-creator | Creator filtering | string | ✖ |
893893
| issue-mentioned | Mentioned filtering | string | ✖ |
894-
| body-includes | Body filtering | string | ✖ |
895-
| title-includes | Title filtering | string | ✖ |
894+
| body-includes | Body filtering, supports filtering of multiple strings | string | ✖ |
895+
| title-includes | Title filtering, supports filtering of multiple strings | string | ✖ |
896896
| inactive-day | Inactive days filtering | number | ✖ |
897897
| exclude-labels | Exclude labels filtering | string | ✖ |
898898
| close-reason | Reason for closing. Default `not_planned`, another `completed` | string | ✖ |
@@ -954,8 +954,8 @@ Find the current repository, the creator is k , the title contains `this` , the
954954
token: ${{ secrets.GITHUB_TOKEN }}
955955
issue-creator: 'k'
956956
issue-state: 'open'
957-
title-includes: 'this'
958-
body-includes: 'that'
957+
title-includes: 'this,that'
958+
body-includes: 'that,this'
959959
labels: 'documentation'
960960
```
961961

@@ -965,8 +965,8 @@ Find the current repository, the creator is k , the title contains `this` , the
965965
| token | [Token explain](#token) | string | ✖ |
966966
| issue-state | State filtering | string | ✖ |
967967
| issue-creator | Creator filtering | string | ✖ |
968-
| title-includes | Title filtering | string | ✖ |
969-
| body-includes | Body filtering | string | ✖ |
968+
| title-includes | Title filtering, supports filtering of multiple strings | string | ✖ |
969+
| body-includes | Body filtering, supports filtering of multiple strings | string | ✖ |
970970
| labels | Labels filtering | string | ✖ |
971971
| exclude-labels | Exclude labels filtering | string | ✖ |
972972
| inactive-day | Inactive days filtering | number | ✖ |
@@ -1024,8 +1024,8 @@ jobs:
10241024
| issue-assignee | Assignee filtering | string | ✖ |
10251025
| issue-creator | Creator filtering | string | ✖ |
10261026
| issue-mentioned | Mentioned filtering | string | ✖ |
1027-
| body-includes | Body filtering | string | ✖ |
1028-
| title-includes | Title filtering | string | ✖ |
1027+
| body-includes | Body filtering, supports filtering of multiple strings | string | ✖ |
1028+
| title-includes | Title filtering, supports filtering of multiple strings | string | ✖ |
10291029
| inactive-day | Inactive days filtering | number | ✖ |
10301030
| lock-reason | Reason for locking issue | string | ✖ |
10311031
| exclude-labels | Exclude labels filtering | string | ✖ |

README.zh-CN.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,8 @@ jobs:
793793
| issue-assignee | 指定人筛选 | string | ✖ |
794794
| issue-creator | 创建人筛选 | string | ✖ |
795795
| issue-mentioned | 提及人筛选 | string | ✖ |
796-
| body-includes | 包含内容筛选 | string | ✖ |
797-
| title-includes | 包含标题筛选 | string | ✖ |
796+
| body-includes | 包含内容筛选,支持多个字符串过滤 | string | ✖ |
797+
| title-includes | 包含标题筛选,支持多个字符串过滤 | string | ✖ |
798798
| inactive-day | 非活跃天数筛选 | number | ✖ |
799799
| inactive-mode | 检测不活跃的模式 | string | ✖ |
800800
| inactive-label | 新增标签名称 | string | ✖ |
@@ -893,8 +893,8 @@ jobs:
893893
| issue-assignee | 指定人筛选 | string | ✖ |
894894
| issue-creator | 创建人筛选 | string | ✖ |
895895
| issue-mentioned | 提及人筛选 | string | ✖ |
896-
| body-includes | 包含内容筛选 | string | ✖ |
897-
| title-includes | 包含标题筛选 | string | ✖ |
896+
| body-includes | 包含内容筛选,支持多个字符串过滤 | string | ✖ |
897+
| title-includes | 包含标题筛选,支持多个字符串过滤 | string | ✖ |
898898
| inactive-day | 非活跃天数筛选 | number | ✖ |
899899
| exclude-labels | 排除标签筛选 | string | ✖ |
900900
| close-reason | 关闭原因。默认`not_planned`未计划,`completed`完成 | string | ✖ |
@@ -956,8 +956,8 @@ jobs:
956956
token: ${{ secrets.GITHUB_TOKEN }}
957957
issue-creator: 'k'
958958
issue-state: 'open'
959-
title-includes: 'this'
960-
body-includes: 'that'
959+
title-includes: 'this,that'
960+
body-includes: 'that,this'
961961
labels: 'documentation'
962962
```
963963

@@ -967,8 +967,8 @@ jobs:
967967
| token | [token 说明](#token) | string | ✖ |
968968
| issue-state | 状态筛选 | string | ✖ |
969969
| issue-creator | 创建者筛选 | string | ✖ |
970-
| title-includes | 标题包含过滤,不填时无校验 | string | ✖ |
971-
| body-includes | 内容包含过滤,不填时无校验 | string | ✖ |
970+
| title-includes | 标题包含过滤,支持多个字符串过滤,不填时无校验 | string | ✖ |
971+
| body-includes | 内容包含过滤,支持多个字符串过滤,不填时无校验 | string | ✖ |
972972
| labels | 标签筛选 | string | ✖ |
973973
| exclude-labels | 排除标签筛选 | string | ✖ |
974974
| inactive-day | 非活跃天数筛选 | number | ✖ |
@@ -1025,8 +1025,8 @@ jobs:
10251025
| issue-assignee | 指定人筛选 | string | ✖ |
10261026
| issue-creator | 创建人筛选 | string | ✖ |
10271027
| issue-mentioned | 提及人筛选 | string | ✖ |
1028-
| body-includes | 包含内容筛选 | string | ✖ |
1029-
| title-includes | 包含标题筛选 | string | ✖ |
1028+
| body-includes | 包含内容筛选,支持多个字符串过滤 | string | ✖ |
1029+
| title-includes | 包含标题筛选,支持多个字符串过滤 | string | ✖ |
10301030
| inactive-day | 非活跃天数筛选 | number | ✖ |
10311031
| lock-reason | 锁定 issue 的原因 | string | ✖ |
10321032
| exclude-labels | 排除标签筛选 | string | ✖ |

src/helper/advanced.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,15 @@ export async function doQueryIssues(
6060
const titleIncludes = core.getInput('title-includes');
6161

6262
const excludeLabelsArr = dealStringToArr(excludeLabels);
63+
const bodyIncludesArr = dealStringToArr(bodyIncludes);
64+
const titleIncludesArr = dealStringToArr(titleIncludes);
6365
issuesList.forEach(async issue => {
64-
const bodyCheck = bodyIncludes ? issue.body.includes(bodyIncludes) : true;
65-
const titleCheck = titleIncludes ? issue.title.includes(titleIncludes) : true;
66+
const bodyCheck =
67+
bodyIncludesArr.length > 0 ? bodyIncludesArr.some(body => issue.body.includes(body)) : true;
68+
const titleCheck =
69+
titleIncludesArr.length > 0
70+
? titleIncludesArr.some(title => issue.title.includes(title))
71+
: true;
6672
/**
6773
* Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request.
6874
* For this reason, "Issues" endpoints may return both issues and pull requests in the response.

0 commit comments

Comments
 (0)