Compare commits

...

17 Commits
v1.8 ... v1.12

Author SHA1 Message Date
xrkffgg
eb91801d3e docs: update changelog 1.12 2021-01-26 22:24:40 +08:00
xrkffgg
616c112b12 feat: add lock-reason (#49)
* feat: add lock-reason

* add dist
2021-01-26 22:17:55 +08:00
xrkffgg
1425c335af refactor: rename allow-permissions (#48)
* refactor: rename allow-permissions

* up
2021-01-26 21:50:10 +08:00
xrkffgg
f777971d6d feat: add allow-permissions (#46)
* feat: add

* up

* up

* add doc
2021-01-26 17:55:42 +08:00
xrkffgg
4c5e1fa83c Update ci.yml 2021-01-26 15:40:09 +08:00
xrkffgg
dcad795964 chore: add prettier (#45)
* chore: add prettier

* add badge

* up
2021-01-26 15:38:25 +08:00
xrkffgg
37632245d8 docs: add users 2021-01-22 15:53:33 +08:00
xrkffgg
9018700e94 docs: add users (#44)
* docs: add users

* fix
2021-01-18 09:54:18 +08:00
xrkffgg
11acd15e70 docs: update version (#43) 2021-01-14 10:41:25 +08:00
xrkffgg
7619e79b94 perf: expand duplicate action (#40)
* perf: expand duplicate action

* up
2021-01-13 11:08:56 +08:00
xrkffgg
c7cf5de709 feat: add question mark duplicate (#38)
* feat: add question mark duplicate

* add package

* add

* up

* up
2021-01-13 09:32:46 +08:00
xrkffgg
273b6abb78 docs: update version Introduction (#37)
* docs: update version Introduction

* add less
2021-01-12 18:12:11 +08:00
xrkffgg
87bca14eb5 fix: duplicate labels set (#36)
* fix: duplicate labels set

* up version

* add labels

* add

* perf map

* fix set

* add info

* avoid setLabels

* change for

* refactor setLabels

* fix

* change info loca

* fix

* fix
2021-01-12 17:05:24 +08:00
xrkffgg
8e05706e43 feat: add random to (#35)
* feat: add random to

* add actions

* up

* up version

* add less
2021-01-11 21:32:00 +08:00
xrkffgg
3836013160 docs: add users (#34) 2021-01-09 17:35:04 +08:00
xrkffgg
fd98f44d05 docs: update users (#33)
* docs: update users

* fix link

* up
2021-01-09 11:36:23 +08:00
xrkffgg
0396471168 docs: perf website (#32) 2021-01-08 11:09:23 +08:00
35 changed files with 5339 additions and 1006 deletions

View File

@@ -11,6 +11,9 @@ jobs:
- name: install - name: install
run: yarn install run: yarn install
- name: format
run: yarn format-check
- name: package - name: package
run: yarn package run: yarn package

4
.prettierignore Normal file
View File

@@ -0,0 +1,4 @@
dist/
lib/
docs-dist/
node_modules/

6
.prettierrc.js Normal file
View File

@@ -0,0 +1,6 @@
const fabric = require('@umijs/fabric');
module.exports = {
...fabric.prettier,
arrowParens: 'avoid',
};

View File

@@ -1,4 +1,4 @@
export default { export default {
base: '/', base: '/',
publicPath: '/' publicPath: '/',
}; };

View File

@@ -6,10 +6,8 @@ const name = 'issues-helper';
export default defineConfig({ export default defineConfig({
title: 'Issue Helper', title: 'Issue Helper',
mode: 'site', mode: 'site',
favicon: favicon: 'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4',
'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4', logo: 'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4',
logo:
'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4',
exportStatic: {}, exportStatic: {},
ssr: {}, ssr: {},
outputPath: 'docs-dist', outputPath: 'docs-dist',
@@ -21,7 +19,7 @@ export default defineConfig({
['en-US', 'English'], ['en-US', 'English'],
], ],
theme: { theme: {
'@c-primary': '#42a5f5', '@c-primary': '#1890ff',
}, },
navs: { navs: {
'zh-CN': [ 'zh-CN': [
@@ -38,7 +36,7 @@ export default defineConfig({
{ title: 'Advanced', path: '/en-US/advanced' }, { title: 'Advanced', path: '/en-US/advanced' },
{ title: 'Changelog', path: '/en-US/changelog' }, { title: 'Changelog', path: '/en-US/changelog' },
{ title: 'GitHub', path: 'https://github.com/actions-cool/issues-helper' }, { title: 'GitHub', path: 'https://github.com/actions-cool/issues-helper' },
] ],
}, },
menus: { menus: {
'/guide': [ '/guide': [

View File

@@ -1,3 +1,31 @@
## v1.12
> It will be the last version of 1.x
`2021.01.26`
- feat: add require-permission. [#46](https://github.com/actions-cool/issues-helper/pull/46) [#48](https://github.com/actions-cool/issues-helper/pull/48)
- feat: add lock-reason. [#49](https://github.com/actions-cool/issues-helper/pull/49)
## v1.11
`2021.01.14`
- feat: add question mark duplicate. [#38](https://github.com/actions-cool/issues-helper/pull/38)
- perf: expand duplicate action. [#40](https://github.com/actions-cool/issues-helper/pull/40)
## v1.10
`2021.01.12`
- fix: duplicate labels set. [#36](https://github.com/actions-cool/issues-helper/pull/36)
## v1.9
`2021.01.11`
- feat: add random to. [#35](https://github.com/actions-cool/issues-helper/pull/35)
## v1.8 ## v1.8
`2021.01.07` `2021.01.07`

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 xrkffgg Copyright (c) 2020-present xrkffgg
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -5,9 +5,11 @@
[![](https://img.shields.io/github/workflow/status/actions-cool/issues-helper/ci?style=flat-square)](https://github.com/actions-cool/issues-helper/actions) [![](https://img.shields.io/github/workflow/status/actions-cool/issues-helper/ci?style=flat-square)](https://github.com/actions-cool/issues-helper/actions)
[![](https://img.shields.io/badge/marketplace-issues--helper-red?style=flat-square)](https://github.com/marketplace/actions/issues-helper) [![](https://img.shields.io/badge/marketplace-issues--helper-red?style=flat-square)](https://github.com/marketplace/actions/issues-helper)
[![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases) [![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases)
[![](https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square&color=%2308979c)](https://github.com/actions-cool/issues-helper/discussions)
[![](https://img.shields.io/github/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers) [![](https://img.shields.io/github/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers)
[![](https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square&color=%2308979c)](https://github.com/actions-cool/issues-helper/discussions)
[![](https://img.shields.io/github/license/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/blob/main/LICENSE) [![](https://img.shields.io/github/license/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
A GitHub Action that easily helps you automatically manage issues A GitHub Action that easily helps you automatically manage issues
@@ -22,6 +24,73 @@ A GitHub Action that easily helps you automatically manage issues
> Private projects have a limit of 2000 times per month. [Specific view](https://github.com/settings/billing). Public are unlimited. > Private projects have a limit of 2000 times per month. [Specific view](https://github.com/settings/billing). Public are unlimited.
## Who is using?
Please leave a message at [**here**](https://github.com/actions-cool/issues-helper/issues/6).
<table>
<tr>
<td align="center" width="180">
<a href="https://github.com/ant-design/ant-design">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
<div>ant-design</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/ant-design-blazor/ant-design-blazor">
<img src="https://raw.githubusercontent.com/ant-design-blazor/ant-design-blazor/7dbee63648e088c73c47eada79c897bc39fc3c26/logo.svg" width="46" />
<div>ant-design-blazor</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/vueComponent/ant-design-vue">
<img src="https://avatars1.githubusercontent.com/u/32120805?s=200&v=4" width="46" />
<div>ant-design-vue</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/umijs/dumi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<div>dumi</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/mui-org/material-ui">
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
<div>material-ui</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/ant-design/pro-components">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
<div>pro-components</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/react-component">
<img src="https://avatars3.githubusercontent.com/u/9441414?s=200&v=4" width="46" />
<div>react-component</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/lijinke666/react-music-player">
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
<div>react-music-player</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/umijs/umi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<div>umi</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/AttoJS/vue-request">
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
<div>vue-request</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/zoo-js/zoo">
<img src="https://avatars1.githubusercontent.com/u/70757173?s=200&v=4" width="46" />
<div>zoo</div>
</a></td>
<td align="center" width="180"></td>
</tr>
</table>
## List ## List
When the following list does not have the features you want, you can submit it in [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18). When the following list does not have the features you want, you can submit it in [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18).
@@ -75,12 +144,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2' assignees: 'xxx' or 'xx1,xx2'
random-to: 1
``` ```
| Param | Desc | Type | Required | | Param | Desc | Type | Required |
@@ -89,6 +159,7 @@ jobs:
| token | [Token explain](#token) | string | ✔ | | token | [Token explain](#token) | string | ✔ |
| issue-number | The number of issue | number | ✔ | | issue-number | The number of issue | number | ✔ |
| assignees | Designated person. No operation when no input or empty character | string | ✖ | | 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` - `actions` support multiple and separated by comma. Like: `add-assignees,add-labels`
- The `name` can be modified according to the actual situation - The `name` can be modified according to the actual situation
@@ -115,7 +186,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -140,7 +211,7 @@ Close the specified issue.
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -173,7 +244,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -217,7 +288,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -236,6 +307,7 @@ jobs:
| body | The body of the new issue | string | ✖ | | body | The body of the new issue | string | ✖ |
| labels | The labels for the new issue | string | ✖ | | labels | The labels for the new issue | string | ✖ |
| assignees | The assignees 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 | ✖ |
| contents | Add [reaction](#reactions-types) | string | ✖ | | contents | Add [reaction](#reactions-types) | string | ✖ |
- `title` default is `Default Title` - `title` default is `Default Title`
@@ -249,7 +321,7 @@ According to [`comment-id`](#comment-id) delete the specified comment.
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -281,7 +353,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -293,26 +365,29 @@ jobs:
| actions | Action type | string | ✔ | | actions | Action type | string | ✔ |
| token | [Token explain](#token) | string | ✔ | | token | [Token explain](#token) | string | ✔ |
| issue-number | The number of issue | number | ✔ | | issue-number | The number of issue | number | ✔ |
| lock-reason | Reason for locking issue | string | ✖ |
- `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam`
⏫ [Back to list](#List) ⏫ [Back to list](#List)
#### `mark-duplicate` #### `mark-duplicate`
Quickly mark duplicate questions, only for issue new comments. Quickly mark duplicate questions, only for issue new comments or edit comments.
```yml ```yml
name: Issue Mark Duplicate name: Issue Mark Duplicate
on: on:
issue_comment: issue_comment:
types: [created] types: [created, edited]
jobs: jobs:
mark-duplicate: mark-duplicate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -328,9 +403,16 @@ jobs:
| labels | Replace the labels of the issue | string | ✖ | | labels | Replace the labels of the issue | string | ✖ |
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ | | contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
| close-issue | Whether to close the issue at the same time | string | ✖ | | close-issue | Whether to close the issue at the same time | string | ✖ |
| require-permission | Permission required | string | ✖ |
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of` - `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 - `close-issue`: Both `true` or `'true'` can take effect
- `require-permission`: When you do not input, there is no limit. Anyone comment will trigger. 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
⏫ [Back to list](#List) ⏫ [Back to list](#List)
@@ -340,7 +422,7 @@ Open the specified issue.
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -361,7 +443,7 @@ Remove the person designated by issue.
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -384,7 +466,7 @@ Remove the specified labels.
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -409,7 +491,7 @@ Replace the labels of issue.
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -432,7 +514,7 @@ Unlock the specified issue.
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -465,7 +547,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -493,7 +575,7 @@ Update the specified issue according to the `issue-number`.
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -543,7 +625,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -586,7 +668,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -639,7 +721,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -678,7 +760,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -712,7 +794,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -760,7 +842,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -782,6 +864,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 | ✖ |
| lock-reason | Reason for locking issue | string | ✖ |
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all - `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-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
@@ -806,7 +889,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -849,7 +932,7 @@ jobs:
if: github.event.label.name == 'watch' if: github.event.label.name == 'watch'
steps: steps:
- name: find comments - name: find comments
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
id: fcid id: fcid
with: with:
actions: 'find-comments' actions: 'find-comments'
@@ -860,7 +943,7 @@ jobs:
- name: create comment - name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }} if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -869,7 +952,7 @@ jobs:
- name: update comment - name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }} if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -901,7 +984,7 @@ When the token is not filled in actions or the corresponding secrets are not add
```yml ```yml
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
id: createissue id: createissue
with: with:
actions: 'create-issue' actions: 'create-issue'
@@ -975,78 +1058,37 @@ Click the `···` icon in the upper right corner of a comment, select `Copy lin
- Use two-level semantic version, such as v1, v1.1, v2, v2.1 - Use two-level semantic version, such as v1, v1.1, v2, v2.1
- v1 represents the initial version - v1 represents the initial version
- The fixes and additions to the v1 version will be released to the v1.1 version - The fixes and additions to the v1 version will be released to the v1.1 version
- When the released v1.x runs stable for a certain period of time, release the advanced v2 version - When the released v1.x runs stable for a certain period of time or undergoes refactoring, release the advanced v2 version
- Version selection - Version selection
- It is recommended to use the latest releases version. It can be seen in [releases](https://github.com/actions-cool/issues-helper/releases) - It is recommended to use the latest releases version. It can be seen in [releases](https://github.com/actions-cool/issues-helper/releases)
- You can also refer to the update log below to select the version - You can also refer to the update log below to select the version
- The latest v1.x release code will be merged into the 1.x branch
- It also supports the direct use of branch versions. Such as: - It also supports the direct use of branch versions. Such as:
```yml ```yml
- name: Issues Helper - name: Issues Helper
uses: actions-cool/issues-helper@main uses: actions-cool/issues-helper@main
# or
- name: Issues Helper
uses: actions-cool/issues-helper@1.x
``` ```
## Actions Template ## Actions Template
- You can directly use this [GitHub Actions workflow template](https://github.com/actions-cool/.github) repositorie template - You can directly use this [GitHub Actions workflow template](https://github.com/actions-cool/.github) repositorie template
- Personal exercises and tests [Actions](https://github.com/xrkffgg/test-ci) repository - Personal exercises and tests [Actions](https://github.com/xrkffgg/test-ci) repository
- Can also refer to the warehouse of [online users](#who-is-using)
## 💖 Who is using? ## ⚡ Feedback
You can come to the following repositories for reference. Please leave a message at [**here**](https://github.com/actions-cool/issues-helper/issues/6). You are very welcome to try it out and put forward your comments. You can use the following methods:
At the same time, if you have any questions during use, you can also ask and inquire in the issue or discussion. - Report bugs or consult with [Issue](https://github.com/actions-cool/issues-helper/issues)
- Discuss via [Discussions](https://github.com/actions-cool/issues-helper/discussions)
<table> - Submit [Pull Request](https://github.com/actions-cool/issues-helper/pulls) to improve the code of `issues-helper`
<tr>
<td align="center" width="180">
<a href="https://github.com/ant-design/ant-design">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
<br />
ant-design
</a></td>
<td align="center" width="180">
<a href="https://github.com/vueComponent/ant-design-vue">
<img src="https://avatars1.githubusercontent.com/u/32120805?s=200&v=4" width="46" />
<br />
ant-design-vue
</a></td>
<td align="center" width="180">
<a href="https://github.com/umijs/dumi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<br />
dumi
</a></td>
<td align="center" width="180">
<a href="https://github.com/mui-org/material-ui">
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
<br />
material-ui
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/lijinke666/react-music-player">
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
<br />
react-music-player
</a></td>
<td align="center" width="180">
<a href="https://github.com/umijs/umi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<br />
umi
</a></td>
<td align="center" width="180">
<a href="https://github.com/AttoJS/vue-request">
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
<br />
vue-request
</a></td>
<td align="center" width="180"></td>
</tr>
</table>
## LICENSE ## LICENSE

212
README.md
View File

@@ -5,9 +5,11 @@
[![](https://img.shields.io/github/workflow/status/actions-cool/issues-helper/ci?style=flat-square)](https://github.com/actions-cool/issues-helper/actions) [![](https://img.shields.io/github/workflow/status/actions-cool/issues-helper/ci?style=flat-square)](https://github.com/actions-cool/issues-helper/actions)
[![](https://img.shields.io/badge/marketplace-issues--helper-red?style=flat-square)](https://github.com/marketplace/actions/issues-helper) [![](https://img.shields.io/badge/marketplace-issues--helper-red?style=flat-square)](https://github.com/marketplace/actions/issues-helper)
[![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases) [![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square&color=orange)](https://github.com/actions-cool/issues-helper/releases)
[![](https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square&color=%2308979c)](https://github.com/actions-cool/issues-helper/discussions)
[![](https://img.shields.io/github/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers) [![](https://img.shields.io/github/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers)
[![](https://img.shields.io/badge/discussions-on%20github-blue?style=flat-square&color=%2308979c)](https://github.com/actions-cool/issues-helper/discussions)
[![](https://img.shields.io/github/license/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/blob/main/LICENSE) [![](https://img.shields.io/github/license/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
一个轻松帮你自动管理 issues 的 GitHub Action 一个轻松帮你自动管理 issues 的 GitHub Action
@@ -22,6 +24,73 @@
> Private 项目每月有 2000 次的限制,[具体查看](https://github.com/settings/billing)。Public 项目无限制。 > Private 项目每月有 2000 次的限制,[具体查看](https://github.com/settings/billing)。Public 项目无限制。
## 谁在使用?
欢迎在 [**这里**](https://github.com/actions-cool/issues-helper/issues/6) 留言。
<table>
<tr>
<td align="center" width="180">
<a href="https://github.com/ant-design/ant-design">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
<div>ant-design</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/ant-design-blazor/ant-design-blazor">
<img src="https://raw.githubusercontent.com/ant-design-blazor/ant-design-blazor/7dbee63648e088c73c47eada79c897bc39fc3c26/logo.svg" width="46" />
<div>ant-design-blazor</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/vueComponent/ant-design-vue">
<img src="https://avatars1.githubusercontent.com/u/32120805?s=200&v=4" width="46" />
<div>ant-design-vue</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/umijs/dumi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<div>dumi</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/mui-org/material-ui">
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
<div>material-ui</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/ant-design/pro-components">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
<div>pro-components</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/react-component">
<img src="https://avatars3.githubusercontent.com/u/9441414?s=200&v=4" width="46" />
<div>react-component</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/lijinke666/react-music-player">
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
<div>react-music-player</div>
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/umijs/umi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<div>umi</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/AttoJS/vue-request">
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
<div>vue-request</div>
</a></td>
<td align="center" width="180">
<a href="https://github.com/zoo-js/zoo">
<img src="https://avatars1.githubusercontent.com/u/70757173?s=200&v=4" width="46" />
<div>zoo</div>
</a></td>
<td align="center" width="180"></td>
</tr>
</table>
## 列 表 ## 列 表
当以下列表没有你想要的功能时,可以在 [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18) 中提出。 当以下列表没有你想要的功能时,可以在 [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18) 中提出。
@@ -75,12 +144,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2' assignees: 'xxx' or 'xx1,xx2'
random-to: 1
``` ```
| 参数 | 描述 | 类型 | 必填 | | 参数 | 描述 | 类型 | 必填 |
@@ -89,6 +159,7 @@ jobs:
| token | [token 说明](#token) | string | ✔ | | token | [token 说明](#token) | string | ✔ |
| issue-number | 指定的 issue | number | ✔ | | issue-number | 指定的 issue | number | ✔ |
| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | | assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ |
| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ |
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels` - `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改 - 其中的 `name` 可根据自行根据实际情况修改
@@ -115,7 +186,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -140,7 +211,7 @@ jobs:
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -173,7 +244,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -217,7 +288,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -236,6 +307,7 @@ jobs:
| body | 新增 issue 的内容 | string | ✖ | | body | 新增 issue 的内容 | string | ✖ |
| labels | 为新增 issue 添加 labels | string | ✖ | | labels | 为新增 issue 添加 labels | string | ✖ |
| assignees | 为新增 issue 添加 assignees | string | ✖ | | assignees | 为新增 issue 添加 assignees | string | ✖ |
| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ |
| contents | 为新增 issue 增加 [reaction](#reactions-types) | string | ✖ | | contents | 为新增 issue 增加 [reaction](#reactions-types) | string | ✖ |
- `title` 默认为:`Default Title` - `title` 默认为:`Default Title`
@@ -249,7 +321,7 @@ jobs:
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -281,7 +353,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -293,26 +365,29 @@ jobs:
| actions | 操作类型 | string | ✔ | | actions | 操作类型 | string | ✔ |
| token | [token 说明](#token) | string | ✔ | | token | [token 说明](#token) | string | ✔ |
| issue-number | 指定的 issue | number | ✔ | | issue-number | 指定的 issue | number | ✔ |
| lock-reason | 锁定 issue 的原因 | string | ✖ |
- `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam`
⏫ [返回列表](#列-表) ⏫ [返回列表](#列-表)
#### `mark-duplicate` #### `mark-duplicate`
快捷标记重复问题,仅作用于 issue 新增评论。 快捷标记重复问题,仅作用于 issue 新增编辑评论。
```yml ```yml
name: Issue Mark Duplicate name: Issue Mark Duplicate
on: on:
issue_comment: issue_comment:
types: [created] types: [created, edited]
jobs: jobs:
mark-duplicate: mark-duplicate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -328,9 +403,16 @@ jobs:
| labels | 替换该 issue 的 labels | string | ✖ | | labels | 替换该 issue 的 labels | string | ✖ |
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ | | contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
| close-issue | 是否同时关闭该 issue | string | ✖ | | close-issue | 是否同时关闭该 issue | string | ✖ |
| require-permission | 要求权限 | string | ✖ |
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of` - `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
- `labels`:优先级最高
- `close-issue``true``'true'` 均可生效 - `close-issue``true``'true'` 均可生效
- `require-permission`:当不输时,即无限制,任何人评论都会触发。可选值有 `admin``write``read``none`
- 团队成员若设置 `read` 权限,则为 `read`
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
- 普通用户为 `read` 权限
- 当设置 `write` 后,`admin``write` 满足条件
⏫ [返回列表](#列-表) ⏫ [返回列表](#列-表)
@@ -340,7 +422,7 @@ jobs:
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -361,7 +443,7 @@ jobs:
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -384,7 +466,7 @@ jobs:
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -409,7 +491,7 @@ jobs:
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -432,7 +514,7 @@ jobs:
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -465,7 +547,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -493,7 +575,7 @@ jobs:
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -541,7 +623,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -584,7 +666,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -633,7 +715,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -672,7 +754,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -706,7 +788,7 @@ jobs:
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -754,7 +836,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -776,6 +858,7 @@ jobs:
| body-includes | 包含内容筛选 | string | ✖ | | body-includes | 包含内容筛选 | string | ✖ |
| title-includes | 包含标题筛选 | string | ✖ | | title-includes | 包含标题筛选 | string | ✖ |
| inactive-day | 非活跃天数筛选 | number | ✖ | | inactive-day | 非活跃天数筛选 | number | ✖ |
| lock-reason | 锁定 issue 的原因 | string | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有 - `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `open`。可选值 `all` `closed`,非这 2 项时,均为 `open` - `issue-state`:默认为 `open`。可选值 `all` `closed`,非这 2 项时,均为 `open`
@@ -800,7 +883,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -843,7 +926,7 @@ jobs:
if: github.event.label.name == 'watch' if: github.event.label.name == 'watch'
steps: steps:
- name: find comments - name: find comments
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
id: fcid id: fcid
with: with:
actions: 'find-comments' actions: 'find-comments'
@@ -854,7 +937,7 @@ jobs:
- name: create comment - name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }} if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -863,7 +946,7 @@ jobs:
- name: update comment - name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }} if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -895,7 +978,7 @@ jobs:
```yml ```yml
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
id: createissue id: createissue
with: with:
actions: 'create-issue' actions: 'create-issue'
@@ -970,78 +1053,37 @@ x2 + y2
- 采用两级语义化版本如v1、v1.1、v2、v2.1 - 采用两级语义化版本如v1、v1.1、v2、v2.1
- v1 表示初始版本 - v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本 - 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定,发布进阶 v2 版本 - 当发布的 v1.x 运行一定时间稳定或进行重构时,发布进阶 v2 版本
- 版本选择 - 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到 - 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
- 同时也可参照下面的更新日志来选择版本 - 同时也可参照下面的更新日志来选择版本
- 也支持直接使用分支版本。如: - 最新的 v1.x release 代码会合并到 1.x 分支中
- 支持直接使用分支版本。如:
```yml ```yml
- name: Issues Helper - name: Issues Helper
uses: actions-cool/issues-helper@main uses: actions-cool/issues-helper@main
# or
- name: Issues Helper
uses: actions-cool/issues-helper@1.x
``` ```
## Actions 模板 ## Actions 模板
- 可直接使用这个 [GitHub Actions workflow template](https://github.com/actions-cool/.github) 仓库的模板 - 可直接使用这个 [GitHub Actions workflow template](https://github.com/actions-cool/.github) 仓库的模板
- 个人练习和测试 [Actions](https://github.com/xrkffgg/test-ci) 的仓库 - 个人练习和测试 [Actions](https://github.com/xrkffgg/test-ci) 的仓库
- 也可以来 [线上使用者](#谁在使用) 的仓库参照
## 💖 谁在使用? ## ⚡ 反馈
你可以来以下项目进行参考。欢迎在 [**这里**](https://github.com/actions-cool/issues-helper/issues/6) 留言。 非常欢迎你来尝试使用,并提出意见,你可以通过以下方式:
同时,如果你在使用过程中有什么疑问,也可以在 issue 或者 discussion 中进行提问和查询。 - 通过 [Issue](https://github.com/actions-cool/issues-helper/issues) 报告 bug 或进行咨询
- 通过 [Discussions](https://github.com/actions-cool/issues-helper/discussions) 进行讨论
<table> - 提交 [Pull Request](https://github.com/actions-cool/issues-helper/pulls) 改进 `issues-helper` 的代码
<tr>
<td align="center" width="180">
<a href="https://github.com/ant-design/ant-design">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
<br />
ant-design
</a></td>
<td align="center" width="180">
<a href="https://github.com/vueComponent/ant-design-vue">
<img src="https://avatars1.githubusercontent.com/u/32120805?s=200&v=4" width="46" />
<br />
ant-design-vue
</a></td>
<td align="center" width="180">
<a href="https://github.com/umijs/dumi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<br />
dumi
</a></td>
<td align="center" width="180">
<a href="https://github.com/mui-org/material-ui">
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
<br />
material-ui
</a></td>
</tr><tr>
<td align="center" width="180">
<a href="https://github.com/lijinke666/react-music-player">
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
<br />
react-music-player
</a></td>
<td align="center" width="180">
<a href="https://github.com/umijs/umi">
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
<br />
umi
</a></td>
<td align="center" width="180">
<a href="https://github.com/AttoJS/vue-request">
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
<br />
vue-request
</a></td>
<td align="center" width="180"></td>
</tr>
</table>
## LICENSE ## LICENSE

View File

@@ -1,7 +1,5 @@
// ************************************************************************** // **************************************************************************
// Add to end // Add to end
const users = [ const users = [
{ {
url: 'https://github.com/ant-design/ant-design', url: 'https://github.com/ant-design/ant-design',
@@ -31,10 +29,25 @@ const users = [
url: 'https://github.com/lijinke666/react-music-player', url: 'https://github.com/lijinke666/react-music-player',
logo: 'https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true' logo: 'https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true'
}, },
{
url: 'https://github.com/ant-design-blazor/ant-design-blazor',
logo: 'https://raw.githubusercontent.com/ant-design-blazor/ant-design-blazor/7dbee63648e088c73c47eada79c897bc39fc3c26/logo.svg'
},
{
url: 'https://github.com/zoo-js/zoo',
logo: 'https://avatars1.githubusercontent.com/u/70757173?s=200&v=4'
},
{
url: 'https://github.com/react-component',
logo: 'https://avatars3.githubusercontent.com/u/9441414?s=200&v=4'
},
{
url: 'https://github.com/ant-design/pro-components',
logo: 'https://avatars1.githubusercontent.com/u/12101536?s=200&v=4'
},
]; ];
// ************************************************************************** // **************************************************************************
module.exports = { module.exports = {
users users
}; };

View File

@@ -20,6 +20,8 @@ inputs:
description: 'Issue title' description: 'Issue title'
assignees: assignees:
description: 'Issue assignees' description: 'Issue assignees'
random-to:
description: 'Issue assignees random to'
labels: labels:
description: 'Issue labels' description: 'Issue labels'
state: state:
@@ -50,12 +52,16 @@ inputs:
description: 'Query use' description: 'Query use'
inactive-day: inactive-day:
description: 'Query use' description: 'Query use'
lock-reason:
description: 'The reason lock issue'
inactive-label: inactive-label:
description: 'Issue label set use' description: 'Issue label set use'
duplicate-command: duplicate-command:
description: 'For mark-duplicate' description: 'For mark-duplicate'
duplicate-labels: duplicate-labels:
description: 'For mark-duplicate add labels' description: 'For mark-duplicate add labels'
require-permission:
description: 'Only the allow can do. Possible admin, write, read, and none.'
remove-labels: remove-labels:
description: 'For remove labels' description: 'For remove labels'
close-issue: close-issue:

2207
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -110,7 +110,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -142,7 +142,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -188,7 +188,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -210,6 +210,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 | ✖ |
| lock-reason | Reason for locking issue | string | ✖ |
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all - `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-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
@@ -232,7 +233,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -138,7 +138,7 @@ jobs:
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -184,7 +184,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -206,6 +206,7 @@ jobs:
| body-includes | 包含内容筛选 | string | ✖ | | body-includes | 包含内容筛选 | string | ✖ |
| title-includes | 包含标题筛选 | string | ✖ | | title-includes | 包含标题筛选 | string | ✖ |
| inactive-day | 非活跃天数筛选 | number | ✖ | | inactive-day | 非活跃天数筛选 | number | ✖ |
| lock-reason | 锁定 issue 的原因 | string | ✖ |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有 - `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all` - `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
@@ -228,7 +229,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,12 +22,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2' assignees: 'xxx' or 'xx1,xx2'
random-to: 1
``` ```
| Param | Desc | Type | Required | | Param | Desc | Type | Required |
@@ -36,6 +37,7 @@ jobs:
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | | token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
| issue-number | The number of issue | number | ✔ | | issue-number | The number of issue | number | ✔ |
| assignees | Designated person. No operation when no input or empty character | string | ✖ | | 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` - `actions` support multiple and separated by comma. Like: `add-assignees,add-labels`
- The `name` can be modified according to the actual situation - The `name` can be modified according to the actual situation
@@ -60,7 +62,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -83,7 +85,7 @@ Close the specified issue.
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -114,7 +116,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -156,7 +158,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -175,6 +177,7 @@ jobs:
| body | The body of the new issue | string | ✖ | | body | The body of the new issue | string | ✖ |
| labels | The labels for the new issue | string | ✖ | | labels | The labels for the new issue | string | ✖ |
| assignees | The assignees 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 | ✖ |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | | contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ |
- `title` default is `Default Title` - `title` default is `Default Title`
@@ -186,7 +189,7 @@ According to [`comment-id`](/en-US/guide/ref#-comment-id) delete the specified c
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -216,7 +219,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -228,24 +231,27 @@ jobs:
| actions | Action type | string | ✔ | | actions | Action type | string | ✔ |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | | token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
| issue-number | The number of issue | number | ✔ | | issue-number | The number of issue | number | ✔ |
| lock-reason | Reason for locking issue | string | ✖ |
- `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam`
## `mark-duplicate` ## `mark-duplicate`
Quickly mark duplicate questions, only for issue new comments. Quickly mark duplicate questions, only for issue new comments or edit comments.
```yml ```yml
name: Issue Mark Duplicate name: Issue Mark Duplicate
on: on:
issue_comment: issue_comment:
types: [created] types: [created, edited]
jobs: jobs:
mark-duplicate: mark-duplicate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -261,9 +267,16 @@ jobs:
| labels | Replace the labels of the issue | string | ✖ | | labels | Replace the labels of the issue | string | ✖ |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ | | contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ |
| close-issue | Whether to close the issue at the same time | string | ✖ | | close-issue | Whether to close the issue at the same time | string | ✖ |
| require-permission | Permission required | string | ✖ |
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of` - `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 - `close-issue`: Both `true` or `'true'` can take effect
- `require-permission`: When you do not input, there is no limit. Anyone comment will trigger. 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> <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. 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.
@@ -277,7 +290,7 @@ Open the specified issue.
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -296,7 +309,7 @@ Remove the person designated by issue.
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -317,7 +330,7 @@ Remove the specified labels.
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -340,7 +353,7 @@ Replace the labels of issue.
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -361,7 +374,7 @@ Unlock the specified issue.
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -392,7 +405,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -418,7 +431,7 @@ Update the specified issue according to the `issue-number`.
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -466,7 +479,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,12 +22,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }} issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2' assignees: 'xxx' or 'xx1,xx2'
random-to: 1
``` ```
| 参数 | 描述 | 类型 | 必填 | | 参数 | 描述 | 类型 | 必填 |
@@ -36,6 +37,7 @@ jobs:
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | | token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
| issue-number | 指定的 issue | number | ✔ | | issue-number | 指定的 issue | number | ✔ |
| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | | assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ |
| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ |
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels` - `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改 - 其中的 `name` 可根据自行根据实际情况修改
@@ -60,7 +62,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -83,7 +85,7 @@ jobs:
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -114,7 +116,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -156,7 +158,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -175,6 +177,7 @@ jobs:
| body | 新增 issue 的内容 | string | ✖ | | body | 新增 issue 的内容 | string | ✖ |
| labels | 为新增 issue 添加 labels | string | ✖ | | labels | 为新增 issue 添加 labels | string | ✖ |
| assignees | 为新增 issue 添加 assignees | string | ✖ | | assignees | 为新增 issue 添加 assignees | string | ✖ |
| random-to | 当设置时,会在 assignees 中随机选择 | number | ✖ |
| contents | 为新增 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | | contents | 为新增 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
- `title` 默认为:`Default Title` - `title` 默认为:`Default Title`
@@ -186,7 +189,7 @@ jobs:
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -216,7 +219,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -228,24 +231,27 @@ jobs:
| actions | 操作类型 | string | ✔ | | actions | 操作类型 | string | ✔ |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | | token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
| issue-number | 指定的 issue | number | ✔ | | issue-number | 指定的 issue | number | ✔ |
| lock-reason | 锁定 issue 的原因 | string | ✖ |
- `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam`
## `mark-duplicate` ## `mark-duplicate`
快捷标记重复问题,仅作用于 issue 新增评论。 快捷标记重复问题,仅作用于 issue 新增编辑评论。
```yml ```yml
name: Issue Mark Duplicate name: Issue Mark Duplicate
on: on:
issue_comment: issue_comment:
types: [created] types: [created, edited]
jobs: jobs:
mark-duplicate: mark-duplicate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -261,9 +267,16 @@ jobs:
| labels | 替换该 issue 的 labels | string | ✖ | | labels | 替换该 issue 的 labels | string | ✖ |
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | | contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
| close-issue | 是否同时关闭该 issue | string | ✖ | | close-issue | 是否同时关闭该 issue | string | ✖ |
| require-permission | 要求权限 | string | ✖ |
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of` - `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
- `labels`:优先级最高
- `close-issue``true``'true'` 均可生效 - `close-issue``true``'true'` 均可生效
- `require-permission`:当不输时,即无限制,任何人评论都会触发。可选值有 `admin``write``read``none`
- 团队成员若设置 `read` 权限,则为 `read`
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
- 普通用户为 `read` 权限
- 当设置 `write` 后,`admin``write` 满足条件
<Alert> <Alert>
注意:使用简洁命令创建的 Duplicate 不显示下图红框内容。但其实这个没有任何影响的。 注意:使用简洁命令创建的 Duplicate 不显示下图红框内容。但其实这个没有任何影响的。
@@ -277,7 +290,7 @@ jobs:
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -296,7 +309,7 @@ jobs:
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -317,7 +330,7 @@ jobs:
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -340,7 +353,7 @@ jobs:
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -361,7 +374,7 @@ jobs:
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -392,7 +405,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -418,7 +431,7 @@ jobs:
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -465,7 +478,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -8,16 +8,22 @@ toc: menu
- Use two-level semantic version, such as v1, v1.1, v2, v2.1 - Use two-level semantic version, such as v1, v1.1, v2, v2.1
- v1 represents the initial version - v1 represents the initial version
- The fixes and additions to the v1 version will be released to the v1.1 version - The fixes and additions to the v1 version will be released to the v1.1 version
- When the released v1.x runs stable for a certain period of time, release the advanced v2 version - When the released v1.x runs stable for a certain period of time or undergoes refactoring, release the advanced v2 version
- Version selection - Version selection
- It is recommended to use the latest releases version. It can be seen in [releases](https://github.com/actions-cool/issues-helper/releases) - It is recommended to use the latest releases version. It can be seen in [releases](https://github.com/actions-cool/issues-helper/releases)
- You can also refer to the update log below to select the version - You can also refer to the update log below to select the version
- The latest v1.x release code will be merged into the 1.x branch
- It also supports the direct use of branch versions. Such as: - It also supports the direct use of branch versions. Such as:
```yml ```yml
- name: Issues Helper - name: Issues Helper
uses: actions-cool/issues-helper@main uses: actions-cool/issues-helper@main
# or
- name: Issues Helper
uses: actions-cool/issues-helper@1.x
``` ```
<embed src="../CHANGELOG.md"></embed> <embed src="../CHANGELOG.md"></embed>

View File

@@ -8,16 +8,22 @@ toc: menu
- 采用两级语义化版本如v1、v1.1、v2、v2.1 - 采用两级语义化版本如v1、v1.1、v2、v2.1
- v1 表示初始版本 - v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本 - 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定,发布进阶 v2 版本 - 当发布的 v1.x 运行一定时间稳定或进行重构时,发布进阶 v2 版本
- 版本选择 - 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到 - 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
- 同时也可参照下面的更新日志来选择版本 - 同时也可参照下面的更新日志来选择版本
- 也支持直接使用分支版本。如: - 最新的 v1.x release 代码会合并到 1.x 分支中
- 支持直接使用分支版本。如:
```yml ```yml
- name: Issues Helper - name: Issues Helper
uses: actions-cool/issues-helper@main uses: actions-cool/issues-helper@main
# or
- name: Issues Helper
uses: actions-cool/issues-helper@1.x
``` ```
<embed src="../CHANGELOG.md"></embed> <embed src="../CHANGELOG.md"></embed>

View File

@@ -17,8 +17,28 @@ if: contains(github.event.issue.body, 'ie') == false
[More](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#functions). [More](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#functions).
## Pass value and output in `yml`
```
with:
actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }}
count-lables: 'true'
```
- `count-lables`: 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
- `check-result`: The judgment condition is `if: steps.xxid.outputs.check-result =='true'`
## `GitHub Actions bot` trigger ## `GitHub Actions bot` trigger
When an action is set, such as adding a label `x1` to an issue, Actions will automatically add a label `x2` to the issue. When an action is set, such as adding a label `x1` to an issue, Actions will automatically add a label `x2` to the issue.
But if this is done by `GitHub Actions bot` (that is, the token in the actions is not passed, or the default `token: ${{ secrets.GITHUB_TOKEN }}` is used), the actions of label `x2` will not be triggered. But if this is done by `GitHub Actions bot` (that is, the token in the actions is not passed, or the default `token: ${{ secrets.GITHUB_TOKEN }}` is used), the actions of label `x2` will not be triggered.
## `assignees` scope
- The owner or collaborator of the warehouse, if there is an organization, including members
- Participants of the issue, including creators and commenters

View File

@@ -18,8 +18,28 @@ if: contains(github.event.issue.body, 'ie') == false
更多[查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#functions)。 更多[查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#functions)。
## `yml` 中传值和输出
```
with:
actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }}
count-lables: 'true'
```
- `count-lables`:不管设置 `true` 还是 `'ture'`,在程序里接收到的都是字符串格式
同时输出的也是字符串格式
- `check-result`:判断条件为 `if: steps.xxid.outputs.check-result == 'true'`
## `GitHub Actions bot` 触发 ## `GitHub Actions bot` 触发
当设置了一个 Actions如为给一个 issue 新增 label `x1`Actions 自动为该 issue 增加 `x2` label。 当设置了一个 Actions如为给一个 issue 新增 label `x1`Actions 自动为该 issue 增加 `x2` label。
但如果这个是由 `GitHub Actions bot` 完成的(即 actions 中 token 不传,或使用默认 `token: ${{ secrets.GITHUB_TOKEN }}`),则不会触发 label `x2` 的 Actions。 但如果这个是由 `GitHub Actions bot` 完成的(即 actions 中 token 不传,或使用默认 `token: ${{ secrets.GITHUB_TOKEN }}`),则不会触发 label `x2` 的 Actions。
## `assignees` 范围
- 仓库的所有者或协作者,若有组织,包括成员
- issue 的参与者,包括创建者、评论者

View File

@@ -33,7 +33,7 @@ jobs:
steps: steps:
- name: help wanted - name: help wanted
if: github.event.label.name == 'help wanted' if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2 uses: actions-cool/issues-helper@1.x
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -50,7 +50,7 @@ jobs:
- `on`: The action trigger condition - `on`: The action trigger condition
- Reference [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows) - Reference [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
- `uses`: Use actions name - `uses`: Use actions name
- `uses: actions-cool/issues-helper@v1.2`。Please [refer](/en-US/changelog) to version selection - `uses: actions-cool/issues-helper@1.x`。Please [refer](/en-US/changelog) to version selection
- `issues-hepler` parameter - `issues-hepler` parameter
- `actions`: The name of the function used, **required**. Support multiple, separated by commas, such as `create-comment,close-issue` means comment and close issue - `actions`: The name of the function used, **required**. Support multiple, separated by commas, such as `create-comment,close-issue` means comment and close issue
- `token`: A person who needs to have push permission token - `token`: A person who needs to have push permission token

View File

@@ -33,7 +33,7 @@ jobs:
steps: steps:
- name: help wanted - name: help wanted
if: github.event.label.name == 'help wanted' if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2 uses: actions-cool/issues-helper@1.x
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -50,7 +50,7 @@ jobs:
- `on`action 触发条件 - `on`action 触发条件
- 参考 [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows) - 参考 [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
- `uses`:使用 actions 名称 - `uses`:使用 actions 名称
- `uses: actions-cool/issues-helper@v1.2`。版本选择请 [参考](/changelog) - `uses: actions-cool/issues-helper@1.x`。版本选择请 [参考](/changelog)
- `issues-hepler` 参数 - `issues-hepler` 参数
- `actions`:使用功能的名称,**必填**。支持多个,需用逗号隔开,如 `create-comment,close-issue` 表示评论和关闭 issue - `actions`:使用功能的名称,**必填**。支持多个,需用逗号隔开,如 `create-comment,close-issue` 表示评论和关闭 issue
- `token`:需拥有 push 权限的人员 token - `token`:需拥有 push 权限的人员 token

View File

@@ -38,7 +38,7 @@ jobs:
steps: steps:
- name: help wanted - name: help wanted
if: github.event.label.name == 'help wanted' if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -51,7 +51,7 @@ jobs:
## 💖 Who is using? ## 💖 Who is using?
<embed src="../README.md#L997-L1044"></embed> <embed src="../README.md#RE-/<table>[^]+?[\r\n]<\/table>/"></embed>
## ⚡ Feedback ## ⚡ Feedback

View File

@@ -38,7 +38,7 @@ jobs:
steps: steps:
- name: help wanted - name: help wanted
if: github.event.label.name == 'help wanted' if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.8 uses: actions-cool/issues-helper@v1.11
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -51,7 +51,7 @@ jobs:
## 💖 谁在使用? ## 💖 谁在使用?
<embed src="../README.md#L997-L1044"></embed> <embed src="../README.md#RE-/<table>[^]+?[\r\n]<\/table>/"></embed>
## ⚡ 反馈 ## ⚡ 反馈

View File

@@ -1,6 +1,6 @@
{ {
"name": "issue-helper", "name": "issues-helper",
"version": "1.7.0", "version": "1.12.0",
"private": true, "private": true,
"description": "Some operations on issue.", "description": "Some operations on issue.",
"main": "src/main.js", "main": "src/main.js",
@@ -10,16 +10,18 @@
"docs-dev:build": "UMI_ENV=dev dumi build", "docs-dev:build": "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", "deploy": "npm run docs:build && npm run docs:deploy",
"format": "prettier --write **/*.ts **/*.js",
"format-check": "prettier --check **/*.ts **/*.js",
"package": "ncc build src/main.js -o dist", "package": "ncc build src/main.js -o dist",
"up-users": "node ./script/update-users.js", "users": "node ./script/update-users.js",
"main": "node ./src/main.js", "main": "node ./src/main.js",
"up-version": "node ./script/update-version.js" "ver": "node ./script/update-version.js"
}, },
"author": "xrkffgg", "author": "xrkffgg",
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/actions-cool/issue-helper.git", "url": "https://github.com/actions-cool/issues-helper.git",
"branch": "main" "branch": "main"
}, },
"keywords": [ "keywords": [
@@ -32,13 +34,15 @@
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/github": "^4.0.0", "@actions/github": "^4.0.0",
"@octokit/rest": "^18.0.12", "@octokit/rest": "^18.0.12",
"dayjs": "^1.9.7" "dayjs": "^1.9.7",
"lodash": "^4.17.20"
}, },
"devDependencies": { "devDependencies": {
"@umijs/fabric": "^2.5.6",
"@vercel/ncc": "^0.25.1", "@vercel/ncc": "^0.25.1",
"common-tags": "^1.8.0", "common-tags": "^1.8.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"dumi": "^1.1.0", "dumi": "^1.1.1",
"gh-pages": "^3.1.0", "gh-pages": "^3.1.0",
"react": "^17.0.1" "react": "^17.0.1"
} }

View File

@@ -17,34 +17,34 @@ for (let j = 1; j <= row; j++) {
let data = ''; let data = '';
data = stripIndent` data = stripIndent`
<tr> <tr>
<td align="center" width="180">${getImg(users[(j-1)*4])}</td> <td align="center" width="180">${getImg(users[(j - 1) * 4])}</td>
<td align="center" width="180">${getImg(users[(j-1)*4+1])}</td> <td align="center" width="180">${getImg(users[(j - 1) * 4 + 1])}</td>
<td align="center" width="180">${getImg(users[(j-1)*4+2])}</td> <td align="center" width="180">${getImg(users[(j - 1) * 4 + 2])}</td>
<td align="center" width="180">${getImg(users[(j-1)*4+3])}</td> <td align="center" width="180">${getImg(users[(j - 1) * 4 + 3])}</td>
</tr>`; </tr>`;
table += data table += data;
}; }
table = `<table> table = `<table>
${table} ${table}
</table> </table>
`; `;
// ************************************************************************** // **************************************************************************
const point = '<table>'; const point = '<table>';
const last = ` const cnPoint = `## 列 表`;
## LICENSE const enPoint = `## List`;
[MIT](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
`;
// ************************************************************************** // **************************************************************************
const cn = readFileSync('./README.md', 'utf8'); const cn = readFileSync('./README.md', 'utf8');
const cnIn = cn.indexOf(point); const cnIn = cn.indexOf(point);
const cnAfterIn = cn.indexOf(cnPoint);
const cnBefore = cn.substring(0, cnIn); const cnBefore = cn.substring(0, cnIn);
const newcn = cnBefore + table + last; const cnAfter = cn.substring(cnAfterIn, cn.length);
const newcn = cnBefore + table + cnAfter;
writeFileSync('./README.md', newcn); writeFileSync('./README.md', newcn);
console.log(`🎉 Done cn`); console.log(`🎉 Done cn`);
@@ -52,30 +52,31 @@ console.log(`🎉 Done cn`);
const en = readFileSync('./README.en-US.md', 'utf8'); const en = readFileSync('./README.en-US.md', 'utf8');
const enIn = en.indexOf(point); const enIn = en.indexOf(point);
const enAfterIn = en.indexOf(enPoint);
const enBefore = en.substring(0, enIn); const enBefore = en.substring(0, enIn);
const newen = enBefore + table + last; const enAfter = en.substring(enAfterIn, en.length);
const newen = enBefore + table + enAfter;
writeFileSync('./README.en-US.md', newen); writeFileSync('./README.en-US.md', newen);
console.log(`🎉 Done en`); console.log(`🎉 Done en`);
// ************************************************************************** // **************************************************************************
function getImg (o) { function getImg(o) {
if (o) { if (o) {
return ` return `
<a href="${o.url}"> <a href="${o.url}">
<img src="${o.logo}" width="46" /> <img src="${o.logo}" width="46" />
<br /> <div>${getName(o)}</div>
${getName(o)} </a>`;
</a>`
} }
return `` return ``;
}; }
function getName (o) { function getName(o) {
if (o) { if (o) {
return o.url.split('/').slice(-1)[0] return o.url.split('/').slice(-1)[0];
} }
return `` return ``;
}; }
// ************************************************************************** // **************************************************************************

View File

@@ -1,7 +1,7 @@
const { readFileSync, writeFileSync } = require('fs'); const { readFileSync, writeFileSync } = require('fs');
const last = /v1\.7/g; const last = /v1\.10/g;
const now = 'v1.8'; const now = 'v1.11';
let readme = readFileSync('./README.md', 'utf-8'); let readme = readFileSync('./README.md', 'utf-8');
readme = readme.replace(last, now); readme = readme.replace(last, now);

View File

@@ -1,5 +1,5 @@
require('dotenv').config(); require('dotenv').config();
const core = require("@actions/core"); const core = require('@actions/core');
const { Octokit } = require('@octokit/rest'); const { Octokit } = require('@octokit/rest');
const { const {
@@ -10,17 +10,9 @@ const {
doCreateIssue, doCreateIssue,
} = require('./base.js'); } = require('./base.js');
const { const { doQueryIssues, getIssuesInMonth, getCreatedMonth } = require('./public.js');
doQueryIssues,
getIssuesInMonth,
getCreatedMonth,
} = require('./public.js');
const { const { dealStringToArr, matchKeyword, getPreMonth } = require('./util.js');
dealInput,
matchKeyword,
getPreMonth
} = require('./util.js');
// ************************************************************************** // **************************************************************************
var dayjs = require('dayjs'); var dayjs = require('dayjs');
@@ -31,22 +23,22 @@ dayjs.extend(utc);
const token = core.getInput('token'); const token = core.getInput('token');
const octokit = new Octokit({ auth: `token ${token}` }); const octokit = new Octokit({ auth: `token ${token}` });
let direction = core.getInput("direction"); let direction = core.getInput('direction');
direction = direction === 'desc' ? 'desc' : 'asc'; direction = direction === 'desc' ? 'desc' : 'asc';
const commentAuth = core.getInput("comment-auth"); const commentAuth = core.getInput('comment-auth');
const bodyIncludes = core.getInput('body-includes'); const bodyIncludes = core.getInput('body-includes');
const titleIncludes = core.getInput('title-includes'); const titleIncludes = core.getInput('title-includes');
const assigneeIncludes = core.getInput('assignee-includes'); const assigneeIncludes = core.getInput('assignee-includes');
let issueState = core.getInput("issue-state") || 'open'; let issueState = core.getInput('issue-state') || 'open';
if (issueState != 'all' && issueState != 'closed') { if (issueState != 'all' && issueState != 'closed') {
issueState = 'open'; issueState = 'open';
} }
const inactiveLabel = core.getInput("inactive-label") || 'inactive'; const inactiveLabel = core.getInput('inactive-label') || 'inactive';
// ************************************************************************** // **************************************************************************
async function doCheckInactive (owner, repo, labels) { async function doCheckInactive(owner, repo, labels) {
const issues = await doQueryIssues(owner, repo, labels, issueState); const issues = await doQueryIssues(owner, repo, labels, issueState);
if (issues.length) { if (issues.length) {
@@ -57,8 +49,8 @@ async function doCheckInactive (owner, repo, labels) {
}); });
if (!arr.includes(inactiveLabel)) { if (!arr.includes(inactiveLabel)) {
await doAddLabels(owner, repo, issues[i].number, inactiveLabel); await doAddLabels(owner, repo, issues[i].number, inactiveLabel);
if (core.getInput("body")) { if (core.getInput('body')) {
await doCreateComment(owner, repo, issues[i].number, core.getInput("body")); await doCreateComment(owner, repo, issues[i].number, core.getInput('body'));
} }
} else { } else {
core.info(`Actions: [add-inactive] issue ${issues[i].number} has label!`); core.info(`Actions: [add-inactive] issue ${issues[i].number} has label!`);
@@ -67,76 +59,74 @@ async function doCheckInactive (owner, repo, labels) {
} else { } else {
core.info(`Actions: [query-issues] empty!`); core.info(`Actions: [query-issues] empty!`);
} }
}; }
/** /**
* 检查 issue 是否满足条件,满足返回 true * 检查 issue 是否满足条件,满足返回 true
* 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个 * 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
* 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问' * 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
*/ */
async function doCheckIssue (owner, repo, issueNumber) { async function doCheckIssue(owner, repo, issueNumber) {
var checkResult = true; var checkResult = true;
const issue = await octokit.issues.get({ const issue = await octokit.issues.get({
owner, owner,
repo, repo,
issue_number: issueNumber issue_number: issueNumber,
}); });
if (!!checkResult && assigneeIncludes) { if (!!checkResult && assigneeIncludes) {
let assigneesCheck = dealInput(assigneeIncludes); let assigneesCheck = dealStringToArr(assigneeIncludes);
let checkAssignee = false; let checkAssignee = false;
issue.data.assignees.forEach(it => { issue.data.assignees.forEach(it => {
if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) { if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) {
checkResult = true; checkResult = true;
checkAssignee = true; checkAssignee = true;
} }
}) });
!checkAssignee ? checkResult = false : null; !checkAssignee ? (checkResult = false) : null;
} }
if (!!checkResult && titleIncludes) { if (!!checkResult && titleIncludes) {
const titleArr = titleIncludes.split('/'); const titleArr = titleIncludes.split('/');
const keyword1 = dealInput(titleArr[0]); const keyword1 = dealStringToArr(titleArr[0]);
const keyword2 = dealInput(titleArr[1]); const keyword2 = dealStringToArr(titleArr[1]);
checkResult = checkResult = keyword2.length
keyword2.length ? ? matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2)
matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) : : matchKeyword(issue.data.title, keyword1);
matchKeyword(issue.data.title, keyword1);
} }
if (!!checkResult && bodyIncludes) { if (!!checkResult && bodyIncludes) {
const bodyArr = bodyIncludes.split('/'); const bodyArr = bodyIncludes.split('/');
const keyword1 = dealInput(bodyArr[0]); const keyword1 = dealStringToArr(bodyArr[0]);
const keyword2 = dealInput(bodyArr[1]); const keyword2 = dealStringToArr(bodyArr[1]);
checkResult = checkResult = keyword2.length
keyword2.length ? ? matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2)
matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) : : matchKeyword(issue.data.body, keyword1);
matchKeyword(issue.data.body, keyword1);
} }
core.info(`Actions: [check-issue][${!!checkResult}] success!`); core.info(`Actions: [check-issue][${!!checkResult}] success!`);
core.setOutput("check-result", !!checkResult); core.setOutput('check-result', !!checkResult);
}; }
async function doCloseIssues (owner, repo, labels) { async function doCloseIssues(owner, repo, labels) {
const issues = await doQueryIssues(owner, repo, labels, 'open'); const issues = await doQueryIssues(owner, repo, labels, 'open');
if (issues.length) { if (issues.length) {
for (let i = 0; i < issues.length; i++) { for (let i = 0; i < issues.length; i++) {
await doCloseIssue(owner, repo, issues[i].number); await doCloseIssue(owner, repo, issues[i].number);
if (core.getInput("body")) { if (core.getInput('body')) {
await doCreateComment(owner, repo, issues[i].number, core.getInput("body")); await doCreateComment(owner, repo, issues[i].number, core.getInput('body'));
} }
} }
} else { } else {
core.info(`Actions: [query-issues] empty!`); core.info(`Actions: [query-issues] empty!`);
} }
}; }
async function doFindComments (owner, repo, issueNumber) { async function doFindComments(owner, repo, issueNumber) {
const res = await octokit.issues.listComments({ const res = await octokit.issues.listComments({
owner, owner,
repo, repo,
issue_number: issueNumber issue_number: issueNumber,
}); });
core.info(`Actions: [find-comments][${issueNumber}] success!`); core.info(`Actions: [find-comments][${issueNumber}] success!`);
let comments = []; let comments = [];
@@ -149,34 +139,34 @@ async function doFindComments (owner, repo, issueNumber) {
auth: item.user.login, auth: item.user.login,
body: item.body, body: item.body,
created: item.created_at, created: item.created_at,
updated: item.updated_at updated: item.updated_at,
}) });
if (direction === 'desc') { if (direction === 'desc') {
comments.reverse(); comments.reverse();
} }
} }
}) });
core.setOutput("comments", comments); core.setOutput('comments', comments);
}; }
async function doLockIssues (owner, repo, labels) { async function doLockIssues(owner, repo, labels) {
const issues = await doQueryIssues(owner, repo, labels, issueState); const issues = await doQueryIssues(owner, repo, labels, issueState);
if (issues.length) { if (issues.length) {
for (let i = 0; i < issues.length; i++) { for (let i = 0; i < issues.length; i++) {
await doLockIssue(owner, repo, issues[i].number); await doLockIssue(owner, repo, issues[i].number);
if (core.getInput("body")) { if (core.getInput('body')) {
await doCreateComment(owner, repo, issues[i].number, core.getInput("body")); await doCreateComment(owner, repo, issues[i].number, core.getInput('body'));
} }
} }
} else { } else {
core.info(`Actions: [query-issues] empty!`); core.info(`Actions: [query-issues] empty!`);
} }
}; }
async function doMonthStatistics (owner, repo, labels, assignees) { async function doMonthStatistics(owner, repo, labels, assignees) {
const countLables = core.getInput("count-lables"); const countLables = core.getInput('count-lables');
const countComments = core.getInput("count-comments"); const countComments = core.getInput('count-comments');
const thisMonth = dayjs.utc().month() + 1; const thisMonth = dayjs.utc().month() + 1;
const year = thisMonth == 1 ? dayjs.utc().year() - 1 : dayjs.utc().year(); const year = thisMonth == 1 ? dayjs.utc().year() - 1 : dayjs.utc().year();
@@ -184,17 +174,13 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
const month = getPreMonth(thisMonth); const month = getPreMonth(thisMonth);
const showMonth = month < 10 ? `0${month}` : month; const showMonth = month < 10 ? `0${month}` : month;
let issues = await getIssuesInMonth( let issues = await getIssuesInMonth(owner, repo, thisMonth);
owner,
repo,
thisMonth
);
if (issues.length == 0) { if (issues.length == 0) {
core.info(`Actions: [query-issues-${month}] empty!`); core.info(`Actions: [query-issues-${month}] empty!`);
return false; return false;
} }
issues = issues.filter(i => { issues = issues.filter(i => {
return getCreatedMonth(i.created_at) == month return getCreatedMonth(i.created_at) == month;
}); });
let total = issues.length; let total = issues.length;
let totalIssues = [...issues]; let totalIssues = [...issues];
@@ -219,10 +205,12 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
} else { } else {
labelsTotals[l.name] = 1; labelsTotals[l.name] = 1;
} }
}) });
} }
} }
let now = dayjs().utc().format('YYYY-MM-DD HH:mm:ss'); let now = dayjs()
.utc()
.format('YYYY-MM-DD HH:mm:ss');
let body = ` let body = `
- Created time: ${now} - Created time: ${now}
@@ -244,8 +232,8 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
for (var lab in labelsTotals) { for (var lab in labelsTotals) {
labelsArr.push({ labelsArr.push({
labelName: lab, labelName: lab,
number: labelsTotals[lab] number: labelsTotals[lab],
}) });
} }
labelsArr.sort((a, b) => b.number - a.number); labelsArr.sort((a, b) => b.number - a.number);
let labelsTitle = ` let labelsTitle = `
@@ -255,12 +243,16 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Number</th> <th>Number</th>
</tr>` </tr>`;
let labelsBody = ''; let labelsBody = '';
labelsArr.forEach(it => { labelsArr.forEach(it => {
labelsBody += `<tr><td>${it.labelName}</td><td>${it.number}</td></tr>` labelsBody += `<tr><td>${it.labelName}</td><td>${it.number}</td></tr>`;
}) });
body = body + labelsTitle + labelsBody + `</table> body =
body +
labelsTitle +
labelsBody +
`</table>
`; `;
} }
@@ -279,21 +271,21 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
<th>Number</th> <th>Number</th>
<th>State</th> <th>State</th>
</tr> </tr>
` `;
let commentBody = ''; let commentBody = '';
maxComments.forEach((it,ind) => { maxComments.forEach((it, ind) => {
commentBody += `<tr> commentBody += `<tr>
<td>${ind + 1}</td> <td>${ind + 1}</td>
<td>${it.number}</td> <td>${it.number}</td>
<td>${it.title}</td> <td>${it.title}</td>
<td>${it.comments}</td> <td>${it.comments}</td>
<td>${it.state}</td></tr>` <td>${it.state}</td></tr>`;
}) });
body = body + commentTitle + commentBody + '</table>'; body = body + commentTitle + commentBody + '</table>';
} }
await doCreateIssue(owner, repo, title, body, labels, assignees); await doCreateIssue(owner, repo, title, body, labels, assignees);
}; }
// ************************************************************************** // **************************************************************************
module.exports = { module.exports = {

View File

@@ -1,27 +1,18 @@
require('dotenv').config(); require('dotenv').config();
const core = require("@actions/core"); const core = require('@actions/core');
const github = require("@actions/github"); const github = require('@actions/github');
const { Octokit } = require('@octokit/rest'); const { Octokit } = require('@octokit/rest');
// ************************************************************************** // **************************************************************************
const ALLREACTIONS = [ const ALLREACTIONS = ['+1', '-1', 'laugh', 'confused', 'heart', 'hooray', 'rocket', 'eyes'];
"+1",
"-1", const { doQueryIssues } = require('./public.js');
"laugh",
"confused",
"heart",
"hooray",
"rocket",
"eyes",
];
const { const {
doQueryIssues dealStringToArr,
} = require('./public.js'); dealRandomAssignees,
const {
dealInput,
testDuplicate, testDuplicate,
checkPermission,
} = require('./util.js'); } = require('./util.js');
// ************************************************************************** // **************************************************************************
@@ -29,53 +20,56 @@ const token = core.getInput('token');
const octokit = new Octokit({ auth: `token ${token}` }); const octokit = new Octokit({ auth: `token ${token}` });
const context = github.context; const context = github.context;
const contents = core.getInput("contents"); const contents = core.getInput('contents');
const randomTo = core.getInput('random-to');
// ************************************************************************** // **************************************************************************
async function doAddAssignees (owner, repo, issueNumber, assignees) { async function doAddAssignees(owner, repo, issueNumber, assignees) {
const arr = dealRandomAssignees(assignees, randomTo);
await octokit.issues.addAssignees({ await octokit.issues.addAssignees({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
assignees: dealInput(assignees) assignees: arr,
}); });
core.info(`Actions: [add-assignees][${assignees}] success!`); core.info(`Actions: [add-assignees][${arr}] success!`);
}; }
async function doAddLabels (owner, repo, issueNumber, labels) { async function doAddLabels(owner, repo, issueNumber, labels) {
await octokit.issues.addLabels({ await octokit.issues.addLabels({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
labels: dealInput(labels) labels: dealStringToArr(labels),
}); });
core.info(`Actions: [add-labels][${labels}] success!`); core.info(`Actions: [add-labels][${labels}] success!`);
}; }
async function doCloseIssue (owner, repo, issueNumber) { async function doCloseIssue(owner, repo, issueNumber) {
await octokit.issues.update({ await octokit.issues.update({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
state: 'closed' state: 'closed',
}); });
core.info(`Actions: [close-issue][${issueNumber}] success!`); core.info(`Actions: [close-issue][${issueNumber}] success!`);
}; }
async function doCreateComment (owner, repo, issueNumber, body) { async function doCreateComment(owner, repo, issueNumber, body) {
const { data } = await octokit.issues.createComment({ const { data } = await octokit.issues.createComment({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
body body,
}); });
core.info(`Actions: [create-comment][${body}] success!`); core.info(`Actions: [create-comment][${body}] success!`);
core.setOutput("comment-id", data.id); core.setOutput('comment-id', data.id);
if (contents) { if (contents) {
await doCreateCommentContent(owner, repo, data.id, dealInput(contents)); await doCreateCommentContent(owner, repo, data.id, dealStringToArr(contents));
} }
}; }
async function doCreateCommentContent(owner, repo, commentId, contents) { async function doCreateCommentContent(owner, repo, commentId, contents) {
if (contents.length) { if (contents.length) {
@@ -85,32 +79,32 @@ async function doCreateCommentContent(owner, repo, commentId, contents) {
owner, owner,
repo, repo,
comment_id: commentId, comment_id: commentId,
content: item content: item,
}); });
core.info(`Actions: [create-reactions][${item}] success!`); core.info(`Actions: [create-reactions][${item}] success!`);
} }
}) });
} }
}; }
async function doCreateIssue (owner, repo, title, body, labels, assignees) { async function doCreateIssue(owner, repo, title, body, labels, assignees) {
let params = { let params = {
owner, owner,
repo, repo,
title, title,
body, body,
labels: dealInput(labels), labels: dealStringToArr(labels),
assignees: dealInput(assignees), assignees: dealRandomAssignees(assignees, randomTo),
}; };
const { data } = await octokit.issues.create(params); const { data } = await octokit.issues.create(params);
core.info(`Actions: [create-issue][${title}] success!`); core.info(`Actions: [create-issue][${title}] success!`);
core.setOutput("issue-number", data.number); core.setOutput('issue-number', data.number);
if (contents) { if (contents) {
await doCreateIssueContent(owner, repo, data.number, dealInput(contents)); await doCreateIssueContent(owner, repo, data.number, dealStringToArr(contents));
} }
}; }
async function doCreateIssueContent(owner, repo, issueNumber, contents) { async function doCreateIssueContent(owner, repo, issueNumber, contents) {
if (contents.length) { if (contents.length) {
@@ -120,160 +114,210 @@ async function doCreateIssueContent(owner, repo, issueNumber, contents) {
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
content: item content: item,
}); });
core.info(`Actions: [create-reactions][${item}] success!`); core.info(`Actions: [create-reactions][${item}] success!`);
} }
}) });
} }
}; }
async function doDeleteComment (owner, repo, commentId) { async function doDeleteComment(owner, repo, commentId) {
await octokit.issues.deleteComment({ await octokit.issues.deleteComment({
owner, owner,
repo, repo,
comment_id: commentId comment_id: commentId,
}); });
core.info(`Actions: [delete-comment][${commentId}] success!`); core.info(`Actions: [delete-comment][${commentId}] success!`);
}; }
async function doLockIssue (owner, repo, issueNumber) { async function doLockIssue(owner, repo, issueNumber) {
await octokit.issues.lock({ const lockReason = core.getInput('lock-reason');
let params = {
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
}); };
const reasons = ['off-topic', 'too heated', 'resolved', 'spam'];
if (lockReason && reasons.includes(lockReason)) {
params.lock_reason = lockReason;
}
await octokit.issues.lock(params);
core.info(`Actions: [lock-issue][${issueNumber}] success!`); core.info(`Actions: [lock-issue][${issueNumber}] success!`);
}; }
async function doMarkDuplicate (owner, repo, labels) { async function doMarkDuplicate(owner, repo, labels) {
if (context.eventName != 'issue_comment') { if (context.eventName != 'issue_comment') {
core.info(`This actions only support on 'issue_comment'!`); core.info(`This actions only support on 'issue_comment'!`);
return false; return false;
} }
if (context.payload.action != 'created') {
core.info(`This actions only support on 'issue_comment' created!`);
return false;
}
const duplicateCommand = core.getInput("duplicate-command"); if (context.payload.action == 'created' || context.payload.action == 'edited') {
const duplicateLabels = core.getInput("duplicate-labels"); const duplicateCommand = core.getInput('duplicate-command');
const removeLables = core.getInput("remove-labels"); const duplicateLabels = core.getInput('duplicate-labels');
const closeIssue = core.getInput("close-issue"); const removeLables = core.getInput('remove-labels');
const closeIssue = core.getInput('close-issue');
const commentId = context.payload.comment.id; const requirePermission = core.getInput('require-permission');
const commentBody = context.payload.comment.body;
const issueNumber = context.payload.issue.number;
const ifCommandInput = !!duplicateCommand; const commentId = context.payload.comment.id;
const commentBody = context.payload.comment.body;
const commentUser = context.payload.comment.user.login;
const issueNumber = context.payload.issue.number;
if ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody)) { const ifCommandInput = !!duplicateCommand;
if (ifCommandInput) {
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of'); if (requirePermission) {
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true); const res = await octokit.repos.getCollaboratorPermissionLevel({
} else if (contents) { owner,
await doCreateCommentContent(owner, repo, commentId, dealInput(contents)); repo,
username: commentUser,
});
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
} }
if (duplicateLabels) {
await doAddLabels(owner, repo, issueNumber, duplicateLabels); if (
} !commentBody.includes('?') &&
if (removeLables) { ((ifCommandInput &&
await doRemoveLabels(owner, repo, issueNumber, removeLables); commentBody.startsWith(duplicateCommand) &&
} commentBody.split(' ')[0] == duplicateCommand) ||
if (labels) { testDuplicate(commentBody))
await doSetLabels(owner, repo, issueNumber, labels); ) {
} if (ifCommandInput) {
if (closeIssue == 'true') { const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
await doCloseIssue(owner, repo, issueNumber); await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
} else if (contents) {
await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents));
}
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber,
});
let newLabels = [];
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber);
}
} else {
core.info(
`This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`,
);
} }
} else { } else {
core.info(`This comment body should start whith 'duplicate-command'`); core.info(`This actions only support on 'issue_comment' created or edited!`);
} }
}; }
async function doOpenIssue (owner, repo, issueNumber) { async function doOpenIssue(owner, repo, issueNumber) {
await octokit.issues.update({ await octokit.issues.update({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
state: 'open' state: 'open',
}); });
core.info(`Actions: [open-issue][${issueNumber}] success!`); core.info(`Actions: [open-issue][${issueNumber}] success!`);
}; }
async function doRemoveAssignees (owner, repo, issueNumber, assignees) { async function doRemoveAssignees(owner, repo, issueNumber, assignees) {
await octokit.issues.removeAssignees({ await octokit.issues.removeAssignees({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
assignees: dealInput(assignees), assignees: dealStringToArr(assignees),
}); });
core.info(`Actions: [remove-assignees][${assignees}] success!`); core.info(`Actions: [remove-assignees][${assignees}] success!`);
}; }
async function doRemoveLabels (owner, repo, issueNumber, labels) { async function doRemoveLabels(owner, repo, issueNumber, labels) {
const issue = await octokit.issues.get({ const dealLabels = dealStringToArr(labels);
owner, for (label of dealLabels) {
repo, await octokit.issues.removeLabel({
issue_number: issueNumber
});
const dealLabels = dealInput(labels);
let addLables = [];
if (dealLabels.length) {
issue.data.labels.forEach(item => {
!dealLabels.includes(item.name) ? addLables.push(item.name) : '';
})
await octokit.issues.setLabels({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
labels: addLables name: label,
}); });
core.info(`Actions: [remove-labels][${labels}] success!`); core.info(`Actions: [remove-labels-foreach][${label}] success!`);
} }
}; core.info(`Actions: [remove-labels][${labels}] success!`);
}
async function doSetLabels (owner, repo, issueNumber, labels) { async function doSetLabels(owner, repo, issueNumber, labels) {
await octokit.issues.setLabels({ // 概率性出现问题https://github.com/octokit/rest.js/issues/1982规避 setLabels
owner, if (labels) {
repo, // await octokit.issues.setLabels({
issue_number: issueNumber, // owner,
labels: dealInput(labels) // repo,
}); // issue_number: issueNumber,
core.info(`Actions: [set-labels][${labels}] success!`); // labels: dealStringToArr(labels)
}; // });
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber,
});
const baseLabels = issue.data.labels.map(({ name }) => name);
const removeLabels = baseLabels.filter(name => !dealStringToArr(labels).includes(name));
const addLabels = dealStringToArr(labels).filter(name => !baseLabels.includes(name));
async function doUnlockIssue (owner, repo, issueNumber) { if (removeLabels.length > 0) {
await doRemoveLabels(owner, repo, issueNumber, removeLabels.toString());
core.info(`Actions: [set-labels-remove][${removeLabels}] success!`);
}
if (addLabels.length > 0) {
await doAddLabels(owner, repo, issueNumber, addLabels.toString());
core.info(`Actions: [set-labels-add][${addLabels}] success!`);
}
core.info(`Actions: [set-labels][${labels}] success!`);
}
}
async function doUnlockIssue(owner, repo, issueNumber) {
await octokit.issues.unlock({ await octokit.issues.unlock({
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
}); });
core.info(`Actions: [unlock-issue][${issueNumber}] success!`); core.info(`Actions: [unlock-issue][${issueNumber}] success!`);
}; }
async function doUpdateComment ( async function doUpdateComment(owner, repo, commentId, body, updateMode, ifUpdateBody) {
owner,
repo,
commentId,
body,
updateMode,
ifUpdateBody,
) {
const comment = await octokit.issues.getComment({ const comment = await octokit.issues.getComment({
owner, owner,
repo, repo,
comment_id: commentId comment_id: commentId,
}) });
const comment_body = comment.data.body; const comment_body = comment.data.body;
let params = { let params = {
owner, owner,
repo, repo,
comment_id: commentId comment_id: commentId,
}; };
if (core.getInput("body") || ifUpdateBody) { if (core.getInput('body') || ifUpdateBody) {
if (updateMode === 'append') { if (updateMode === 'append') {
params.body = `${comment_body}\n${body}`; params.body = `${comment_body}\n${body}`;
} else { } else {
@@ -285,11 +329,11 @@ async function doUpdateComment (
} }
if (contents) { if (contents) {
await doCreateCommentContent(owner, repo, commentId, dealInput(contents)); await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents));
} }
}; }
async function doUpdateIssue ( async function doUpdateIssue(
owner, owner,
repo, repo,
issueNumber, issueNumber,
@@ -298,26 +342,26 @@ async function doUpdateIssue (
body, body,
updateMode, updateMode,
assignees, assignees,
labels labels,
) { ) {
const issue = await octokit.issues.get({ const issue = await octokit.issues.get({
owner, owner,
repo, repo,
issue_number: issueNumber issue_number: issueNumber,
}) });
const issue_body = issue.data.body; const issue_body = issue.data.body;
const issue_title = issue.data.title; const issue_title = issue.data.title;
let issue_labels = []; let issue_labels = [];
if (issue.data.labels.length > 0) { if (issue.data.labels.length > 0) {
issue.data.labels.forEach(it =>{ issue.data.labels.forEach(it => {
issue_labels.push(it.name); issue_labels.push(it.name);
}); });
} }
let issue_assignees = []; let issue_assignees = [];
if (issue.data.assignees.length > 0) { if (issue.data.assignees.length > 0) {
issue.data.assignees.forEach(it =>{ issue.data.assignees.forEach(it => {
issue_assignees.push(it.login); issue_assignees.push(it.login);
}); });
} }
@@ -326,13 +370,13 @@ async function doUpdateIssue (
owner, owner,
repo, repo,
issue_number: issueNumber, issue_number: issueNumber,
state state,
}; };
params.title = core.getInput("title") ? title : issue_title; params.title = core.getInput('title') ? title : issue_title;
let next_body; let next_body;
if (core.getInput("body")) { if (core.getInput('body')) {
if (updateMode === 'append') { if (updateMode === 'append') {
next_body = `${issue_body}\n${body}`; next_body = `${issue_body}\n${body}`;
} else { } else {
@@ -343,8 +387,8 @@ async function doUpdateIssue (
} }
params.body = next_body; params.body = next_body;
params.labels = labels ? dealInput(labels) : issue_labels; params.labels = labels ? dealStringToArr(labels) : issue_labels;
params.assignees = assignees ? dealInput(assignees) : issue_assignees; params.assignees = assignees ? dealStringToArr(assignees) : issue_assignees;
await octokit.issues.update(params); await octokit.issues.update(params);
core.info(`Actions: [update-issue][${issueNumber}] success!`); core.info(`Actions: [update-issue][${issueNumber}] success!`);
@@ -352,21 +396,21 @@ async function doUpdateIssue (
if (contents) { if (contents) {
await doCreateIssueContent(owner, repo, issueNumber, contents); await doCreateIssueContent(owner, repo, issueNumber, contents);
} }
}; }
async function doWelcome (owner, repo, assignees, labels, body) { async function doWelcome(owner, repo, assignees, labels, body) {
const context = github.context; const context = github.context;
const isIssue = !!context.payload.issue; const isIssue = !!context.payload.issue;
const issueContents = core.getInput("issue-contents"); const issueContents = core.getInput('issue-contents');
if (!isIssue) { if (!isIssue) {
core.setFailed("The event that triggered this action must be a issue. Error!"); core.setFailed('The event that triggered this action must be a issue. Error!');
} else { } else {
const auth = context.payload.sender.login; const auth = context.payload.sender.login;
core.info(`Actions: [welcome: auth=][${auth}]`); core.info(`Actions: [welcome: auth=][${auth}]`);
const issueNumber = context.issue.number; const issueNumber = context.issue.number;
const issues = await doQueryIssues(owner, repo, false, 'all', auth); const issues = await doQueryIssues(owner, repo, false, 'all', auth);
if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) { if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) {
if (core.getInput("body")) { if (core.getInput('body')) {
await doCreateComment(owner, repo, issueNumber, body); await doCreateComment(owner, repo, issueNumber, body);
} else { } else {
core.info(`Actions: [welcome] no body!`); core.info(`Actions: [welcome] no body!`);
@@ -381,23 +425,23 @@ async function doWelcome (owner, repo, assignees, labels, body) {
} }
if (issueContents) { if (issueContents) {
await doCreateIssueContent(owner, repo, issueNumber, dealInput(issueContents)); await doCreateIssueContent(owner, repo, issueNumber, dealStringToArr(issueContents));
} }
} else { } else {
core.info(`Actions: [welcome][${auth}] is not first time!`); core.info(`Actions: [welcome][${auth}] is not first time!`);
} }
} }
}; }
// ************************************************************************** // **************************************************************************
function testContent(con) { function testContent(con) {
if (ALLREACTIONS.includes(con)) { if (ALLREACTIONS.includes(con)) {
return true; return true;
} else { } else {
core.setFailed("This actions not supported!"); core.setFailed('This actions not supported!');
return false; return false;
} }
}; }
// ************************************************************************** // **************************************************************************
module.exports = { module.exports = {

View File

@@ -22,7 +22,6 @@
margin-right: 0 !important; margin-right: 0 !important;
background: linear-gradient(45deg,#72a2de 30%,#5db8c7 90%) !important; background: linear-gradient(45deg,#72a2de 30%,#5db8c7 90%) !important;
border: none !important; border: none !important;
color: #000 !important;
border-radius: 8px !important; border-radius: 8px !important;
text-align: center; text-align: center;
@@ -54,3 +53,60 @@
} }
} }
} }
.__dumi-default-layout-features + .__dumi-default-layout-content {
td {
transition: all 0.3s;
&:hover {
box-shadow: 0 1px 2px -2px rgba(0,0,0,.16), 0 3px 6px 0 rgba(0,0,0,.12), 0 5px 12px 4px rgba(0,0,0,.09);
}
}
}
.__dumi-default-locale-select {
background: linear-gradient(45deg,#72a2de 30%,#5db8c7 90%) !important;
border-radius: 2px !important;
border: none !important;
a {
color: #fff !important;
letter-spacing: 0.6px;
}
&::before {
position: absolute;
top: 0;
right: 0;
bottom: auto;
left: auto;
display: inline-block;
width: 0;
height: 0;
background: linear-gradient(
225deg,
white 45%,
#aaa 50%,
#ccc 56%,
white 80%
);
box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4);
opacity: 1;
transition-duration: 0.3s;
transition-property: width, height;
content: '';
}
&:hover::before {
width: 14px;
height: 14px;
}
}
.__dumi-default-menu + .__dumi-default-layout-content {
tbody tr:hover {
background: #fafafa;
}
}
.__dumi-default-alert {
box-shadow: 0 6px 16px 2px rgba(0,0,0,.06) !important;
border-radius: 2px !important;
border: 1px solid #0000000f;
}

View File

@@ -1,5 +1,9 @@
.markdown table { .markdown table {
width: auto !important; width: auto !important;
a:hover {
text-decoration: none;
}
} }
.markdown table td:first-child { .markdown table td:first-child {
@@ -9,6 +13,7 @@
code { code {
padding: 1px 5px !important; padding: 1px 5px !important;
border-radius: 4px; border-radius: 4px;
color: #ff7875 !important;
background: rgba(0, 0, 0, 0.06) !important; background: rgba(0, 0, 0, 0.06) !important;
box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
border: 1px solid rgba(0,0,0,0.1); border: 1px solid rgba(0,0,0,0.1);

View File

@@ -1,5 +1,5 @@
const core = require("@actions/core"); const core = require('@actions/core');
const github = require("@actions/github"); const github = require('@actions/github');
// ************************************************************************** // **************************************************************************
const { const {
@@ -68,24 +68,24 @@ async function main() {
const issueNumber = core.getInput('issue-number'); const issueNumber = core.getInput('issue-number');
const commentId = core.getInput('comment-id'); const commentId = core.getInput('comment-id');
const defaultBody = `Currently at ${owner}/${repo}. And this is default comment.` const defaultBody = `Currently at ${owner}/${repo}. And this is default comment.`;
const body = core.getInput("body") || defaultBody; const body = core.getInput('body') || defaultBody;
const defaultTitle = `Default Title`; const defaultTitle = `Default Title`;
const title = core.getInput("title") || defaultTitle; const title = core.getInput('title') || defaultTitle;
const assignees = core.getInput("assignees"); const assignees = core.getInput('assignees');
const labels = core.getInput("labels"); const labels = core.getInput('labels');
const state = core.getInput("state") || 'open'; const state = core.getInput('state') || 'open';
let updateMode = core.getInput("update-mode"); let updateMode = core.getInput('update-mode');
if (updateMode !== 'append') { if (updateMode !== 'append') {
updateMode = 'replace'; updateMode = 'replace';
} }
// actions // actions
const actions = core.getInput("actions", { required: true }); const actions = core.getInput('actions', { required: true });
const actionsArr = actions.split(','); const actionsArr = actions.split(',');
actionsArr.forEach(item => { actionsArr.forEach(item => {
@@ -96,9 +96,9 @@ async function main() {
if (ALLACTIONS.includes(action)) { if (ALLACTIONS.includes(action)) {
choseActions(action); choseActions(action);
} else { } else {
core.setFailed("This actions not supported!"); core.setFailed('This actions not supported!');
} }
}; }
async function choseActions(action) { async function choseActions(action) {
switch (action) { switch (action) {
@@ -143,13 +143,7 @@ async function main() {
await doUnlockIssue(owner, repo, issueNumber); await doUnlockIssue(owner, repo, issueNumber);
break; break;
case 'update-comment': case 'update-comment':
await doUpdateComment( await doUpdateComment(owner, repo, commentId, body, updateMode);
owner,
repo,
commentId,
body,
updateMode
);
break; break;
case 'update-issue': case 'update-issue':
await doUpdateIssue( await doUpdateIssue(
@@ -161,70 +155,38 @@ async function main() {
body, body,
updateMode, updateMode,
assignees, assignees,
labels labels,
); );
break; break;
case 'welcome': case 'welcome':
await doWelcome( await doWelcome(owner, repo, assignees, labels, body);
owner,
repo,
assignees,
labels,
body
);
break; break;
// advanced // advanced
case 'check-inactive': case 'check-inactive':
await doCheckInactive( await doCheckInactive(owner, repo, labels);
owner,
repo,
labels
)
break; break;
case 'check-issue': case 'check-issue':
await doCheckIssue( await doCheckIssue(owner, repo, issueNumber);
owner,
repo,
issueNumber
);
break; break;
case 'close-issues': case 'close-issues':
await doCloseIssues( await doCloseIssues(owner, repo, labels);
owner,
repo,
labels
)
break; break;
case 'find-comments': case 'find-comments':
await doFindComments( await doFindComments(owner, repo, issueNumber);
owner,
repo,
issueNumber
);
break; break;
case 'lock-issues': case 'lock-issues':
await doLockIssues( await doLockIssues(owner, repo, labels);
owner,
repo,
labels
);
break; break;
case 'month-statistics': case 'month-statistics':
await doMonthStatistics( await doMonthStatistics(owner, repo, labels, assignees);
owner,
repo,
labels,
assignees
);
break; break;
// default // default
default: default:
break; break;
} }
}; }
} } catch (error) {
catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
} }
} }

View File

@@ -1,10 +1,8 @@
require('dotenv').config(); require('dotenv').config();
const core = require("@actions/core"); const core = require('@actions/core');
const { Octokit } = require('@octokit/rest'); const { Octokit } = require('@octokit/rest');
const { const { getPreMonth } = require('./util.js');
getPreMonth
} = require('./util.js');
// ************************************************************************** // **************************************************************************
var dayjs = require('dayjs'); var dayjs = require('dayjs');
@@ -19,26 +17,26 @@ const octokit = new Octokit({ auth: `token ${token}` });
const perPage = 100; const perPage = 100;
const issueCreator = core.getInput("issue-creator"); const issueCreator = core.getInput('issue-creator');
const issueAssignee = core.getInput('issue-assignee'); const issueAssignee = core.getInput('issue-assignee');
const issueMentioned = core.getInput('issue-mentioned'); const issueMentioned = core.getInput('issue-mentioned');
const bodyIncludes = core.getInput('body-includes'); const bodyIncludes = core.getInput('body-includes');
const titleIncludes = core.getInput('title-includes'); const titleIncludes = core.getInput('title-includes');
const inactiveDay = core.getInput("inactive-day"); const inactiveDay = core.getInput('inactive-day');
// ************************************************************************** // **************************************************************************
async function doQueryIssues (owner, repo, labels, state, creator) { async function doQueryIssues(owner, repo, labels, state, creator) {
let params = { let params = {
owner, owner,
repo, repo,
state, state,
}; };
issueCreator ? params.creator = issueCreator : null; issueCreator ? (params.creator = issueCreator) : null;
issueAssignee ? params.assignee = issueAssignee : null; issueAssignee ? (params.assignee = issueAssignee) : null;
issueMentioned ? params.mentioned = issueMentioned : null; issueMentioned ? (params.mentioned = issueMentioned) : null;
if (labels) { if (labels) {
params.labels = labels; params.labels = labels;
@@ -73,47 +71,51 @@ async function doQueryIssues (owner, repo, labels, state, creator) {
issueNumbers.push(iss.number); issueNumbers.push(iss.number);
} }
} }
}) });
core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`); core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`);
} }
return issues; return issues;
}; }
async function getIssues (params, page = 1) { async function getIssues(params, page = 1) {
let { data: issues } = await octokit.issues.listForRepo({ let { data: issues } = await octokit.issues.listForRepo({
...params, ...params,
per_page: perPage, per_page: perPage,
page page,
}); });
if (issues.length >= perPage) { if (issues.length >= perPage) {
issues = issues.concat(await getIssues(params, page + 1)); issues = issues.concat(await getIssues(params, page + 1));
} }
return issues; return issues;
}; }
async function getIssuesInMonth (owner, repo, thisMonth, page = 1) { async function getIssuesInMonth(owner, repo, thisMonth, page = 1) {
const month = getPreMonth(thisMonth); const month = getPreMonth(thisMonth);
let { data: issues } = await octokit.issues.listForRepo({ let { data: issues } = await octokit.issues.listForRepo({
owner, owner,
repo, repo,
state: 'all', state: 'all',
per_page: perPage, per_page: perPage,
page page,
}); });
issues = issues.filter(i => { issues = issues.filter(i => {
return i.pull_request === undefined return i.pull_request === undefined;
}); });
if (issues.length && getCreatedMonth(issues[issues.length - 1].created_at) >= month) { if (issues.length && getCreatedMonth(issues[issues.length - 1].created_at) >= month) {
issues = issues.concat(await getIssuesInMonth(owner, repo, thisMonth, page + 1)); issues = issues.concat(await getIssuesInMonth(owner, repo, thisMonth, page + 1));
} }
return issues; return issues;
}; }
// ************************************************************************** // **************************************************************************
function getCreatedMonth (d) { function getCreatedMonth(d) {
return dayjs(d).utc().month() + 1; return (
}; dayjs(d)
.utc()
.month() + 1
);
}
// ************************************************************************** // **************************************************************************
module.exports = { module.exports = {

View File

@@ -1,4 +1,6 @@
function dealInput (para) { const sampleSize = require('lodash/sampleSize');
function dealStringToArr(para) {
/** /**
* in 'x1,x2,x3' * in 'x1,x2,x3'
* out ['x1','x2','x3'] * out ['x1','x2','x3']
@@ -7,21 +9,29 @@ function dealInput (para) {
if (para) { if (para) {
const paraArr = para.split(','); const paraArr = para.split(',');
paraArr.forEach(it => { paraArr.forEach(it => {
if(it.trim()){ if (it.trim()) {
arr.push(it.trim()) arr.push(it.trim());
} }
}) });
} }
return arr; return arr;
}; }
function matchKeyword (content, keywords) { function dealRandomAssignees(assignees, randomTo) {
let arr = dealStringToArr(assignees);
if (randomTo && Number(randomTo) > 0 && Number(randomTo) < arr.length) {
arr = sampleSize(arr, randomTo);
}
return arr;
}
function matchKeyword(content, keywords) {
return keywords.find(item => content.toLowerCase().includes(item)); return keywords.find(item => content.toLowerCase().includes(item));
}; }
function testDuplicate(body) { function testDuplicate(body) {
if (!body || !body.startsWith('Duplicate of')) { if (!body || !body.startsWith('Duplicate of')) {
return false return false;
} }
let arr = body.split(' '); let arr = body.split(' ');
@@ -30,15 +40,29 @@ function testDuplicate(body) {
} else { } else {
return false; return false;
} }
}; }
function getPreMonth (m) { function getPreMonth(m) {
return m == 1 ? 12 : m -1; return m == 1 ? 12 : m - 1;
}; }
function checkPermission(require, permission) {
/**
* 有权限返回 true
*/
const permissions = ['none', 'read', 'write', 'admin'];
const requireNo = permissions.indexOf(require);
const permissionNo = permissions.indexOf(permission);
return requireNo <= permissionNo;
}
// **********************************************************
module.exports = { module.exports = {
dealInput, dealStringToArr,
dealRandomAssignees,
getPreMonth, getPreMonth,
matchKeyword, matchKeyword,
testDuplicate, testDuplicate,
checkPermission,
}; };

2632
yarn.lock

File diff suppressed because it is too large Load Diff