Compare commits

..

25 Commits
v1 ... v1.3

Author SHA1 Message Date
xrkffgg
caed683da4 chore: update version 2020-12-28 14:05:32 +08:00
xrkffgg
bbb5bbb425 feat: add welcome (#19)
* feat: add welcome

* add

* fix

* add

* add

* add

* fix

* add doc

* update
2020-12-28 14:03:32 +08:00
xrkffgg
c5b5ee5c35 docs: add discuss 2020-12-28 10:15:39 +08:00
xrkffgg
78c1ba59b9 chore: fix deply version 2020-12-27 02:49:17 +08:00
xrkffgg
4487540b6a docs: fix repository version 2020-12-27 02:46:05 +08:00
xrkffgg
5d67e9fd3d docs: add online 2020-12-27 02:41:43 +08:00
xrkffgg
6189e252e2 chore: fix umi.ts 2020-12-27 02:24:53 +08:00
xrkffgg
5e251408e1 Create surge-preview.yml 2020-12-27 02:19:37 +08:00
xrkffgg
ebb8028be3 Update ci.yml 2020-12-27 02:18:30 +08:00
xrkffgg
18ae4ef9c4 feat: add online doc (#13)
* feat: add online site

* add
2020-12-27 02:16:18 +08:00
xrkffgg
072eaa8147 docs: update user 2020-12-25 22:10:17 +08:00
xrkffgg
8175da541c docs: perf desc 2020-12-25 09:17:20 +08:00
xrkffgg
c5ab529e59 docs: fix typo 2020-12-25 02:22:50 +08:00
xrkffgg
1e0cecdcea docs: update changelog & pref doc 2020-12-25 02:21:14 +08:00
xrkffgg
13ffb8b717 perf: remove console 2020-12-25 02:10:26 +08:00
xrkffgg
b5274335c3 feat: add check-issue & remove labels (#12) 2020-12-25 01:33:27 +08:00
xrkffgg
62ec5c7335 Delete compressed-size.yml 2020-12-24 16:40:51 +08:00
xrkffgg
822d3a57be fix: yml not support array (#11)
* fix: yml not support array

* add
2020-12-24 16:40:07 +08:00
xrkffgg
1d0bb25b58 Create compressed-size.yml 2020-12-24 15:16:54 +08:00
John60676
e92345f030 docs: add ref user (#9)
* refactor: add ref template user

* refactor: update README
2020-12-24 14:02:04 +08:00
xrkffgg
4f43f584a7 docs: update description 2020-12-24 13:07:49 +08:00
xrkffgg
597b0b36ce docs: add user (#8)
* docs: add user

* fix

* add

* add
2020-12-24 13:00:12 +08:00
xrkffgg
87d4e59578 docs: update text 2020-12-24 10:06:43 +08:00
xrkffgg
90971f72b3 docs: update badge 2020-12-24 10:05:48 +08:00
xrkffgg
4db267691c docs: update badge 2020-12-23 22:29:01 +08:00
37 changed files with 3983 additions and 1105 deletions

1
.env
View File

@@ -1 +0,0 @@
GH_TOKEN=

View File

@@ -14,3 +14,6 @@ jobs:
- name: package
run: yarn package
- name: package
run: yarn docs:build

20
.github/workflows/surge-preview.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: 🔂 Surge PR Preview
on: pull_request_target
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- uses: afc163/surge-preview@v1
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
build: |
yarn
yarn docs-dev:build
dist: docs-dist
teardown: 'true'

1
.gitignore vendored
View File

@@ -11,6 +11,7 @@ yarn-debug.log*
yarn-error.log*
# Private
.env
# misc
.DS_Store

4
.umirc.dev.ts Normal file
View File

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

82
.umirc.ts Normal file
View File

@@ -0,0 +1,82 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';
const name = 'issues-helper';
export default defineConfig({
title: 'Issue Helper',
mode: 'site',
favicon:
'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4',
logo:
'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4',
exportStatic: {},
outputPath: 'docs-dist',
hash: true,
base: `/${name}/`,
publicPath: `/${name}/`,
locales: [
['zh-CN', '中文'],
['en-US', 'English'],
],
theme: {
'@c-primary': '#42a5f5',
},
navs: {
'zh-CN': [
{ title: '指 南', path: '/guide' },
{ title: '基 础', path: '/base' },
{ title: '进 阶', path: '/advanced' },
{ title: '更新日志', path: '/changelog' },
{ title: 'GitHub', path: 'https://github.com/actions-cool/issues-helper' },
],
'en-US': [
{ title: 'Guide', path: '/en-US/guide' },
{ title: 'Base', path: '/en-US/base' },
{ title: 'Advanced', path: '/en-US/advanced' },
{ title: 'Changelog', path: '/en-US/changelog' },
{ title: 'GitHub', path: 'https://github.com/actions-cool/issues-helper' },
]
},
menus: {
'/guide': [
{
title: '🍭 介 绍',
children: ['/guide/index', '/guide/start'],
},
{
title: '🎁 参 考',
path: '/guide/ref',
},
{
title: '💬 FAQ',
path: '/guide/faq',
},
],
'/en-US/guide': [
{
title: '🍭 Guide',
children: ['/guide/index', '/guide/start'],
},
{
title: '🎁 Reference',
path: '/guide/ref',
},
{
title: '💬 FAQ',
path: '/guide/faq',
},
],
},
styles: [
`
.markdown table {
width: auto !important;
}
.__dumi-default-code-block + table {
margin-top: 16px;
}
`,
]
});

952
README.en-US.md Normal file
View File

@@ -0,0 +1,952 @@
# 🤖 Issues Helper
[简体中文](./README.md) | English
[![](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)
[![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi)
[![](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/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
[Online documentation](https://actions-cool.github.io/issues-helper) | [Changelog](https://actions-cool.github.io/issues-helper/en-US/changelog)
## 😎 Why use GitHub Action?
1. Complete free
2. Fully automatic
3. Hosted on the GitHub server, as long as GitHub is not down, it is not affected
> Private projects have a limit of 2000 times per month. [Specific view](https://github.com/settings/billing). Public are unlimited.
## 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).
- ⭐ Base
- [`add-assignees`](#add-assignees)
- [`add-labels`](#add-labels)
- [`close-issue`](#close-issue)
- [`create-comment`](#create-comment)
- [`create-issue`](#create-issue)
- [`delete-comment`](#delete-comment)
- [`lock-issue`](#lock-issue)
- [`open-issue`](#open-issue)
- [`remove-assignees`](#remove-assignees)
- [`remove-labels`](#remove-labels)
- [`set-labels`](#set-labels)
- [`unlock-issue`](#unlock-issue)
- [`update-comment`](#update-comment)
- [`update-issue`](#update-issue)
- [`welcome`](#welcome)
- ⭐ Advanced
- [`check-inactive`](#check-inactive)
- [`check-issue`](#check-issue)
- [`close-issues`](#close-issues)
- [`find-comments`](#find-comments)
- [`lock-issues`](#lock-issues)
- 🌰 Example
- [`find-comments + create-comment + update-comment`](#find-comments--create-comment--update-comment)
## 🚀 Usage
### ⭐ Base
In order to better display the function, the following is an example of the actual scene, please refer to it flexibly.
#### `add-assignees`
When an issue is added or modified, assign this issue to one or more people.
```yml
name: Add Assigness
on:
issues:
types: [opened, edited]
jobs:
add-assigness:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| assignees | Designated person. No operation when no input or empty character | string | ✖ | v1.1 |
- `actions` support multiple and separated by comma. Like: `add-assignees,add-labels`
- The `name` can be modified according to the actual situation
- [Reference to on](#github-docs)
- `${{ github.event.issue.number }}` is the current issue. [More references](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
- `assignees` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
⏫ [Back to list](#List)
#### `add-labels`
When the content of a new issue does not contain the specified format, add labels for the issue.
```yml
name: Add Labels
on:
issues:
types: [opened]
jobs:
add-labels:
runs-on: ubuntu-latest
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug' or 'xx1,xx2'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| labels | New labels. When it is not filled in or is empty character, do not add | string | ✖ | v1.1 |
- `labels` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
⏫ [Back to list](#List)
#### `close-issue`
Close the specified issue.
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
body: 'This is auto closed.'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
⏫ [Back to list](#List)
#### `create-comment`
When a designated label is added, comment on the issue.
```yml
name: Create Comment
on:
issues:
types: [labeled]
jobs:
create-comment:
runs-on: ubuntu-latest
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Add some comments.
你好 @${{ github.event.issue.user.login }}。巴拉巴拉。
contents: '+1' or '+1,heart'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| body | Add comment content | string | ✖ | v1 |
| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
- `body` default is `Currently at ${owner}/${repo}. And this is default comment.`
- Where `${owner}/${repo}` means the current repo
- Return `comment-id`, which can be used for subsequent operations. [Usage reference](#outputs-use)
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
- `contents` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
⏫ [Back to list](#List)
#### `create-issue`
Here is an example, add an issue at UTC 00:00 on the 1st of every month.
```yml
name: Create Issue
on:
schedule:
- cron: "0 0 1 * *"
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: 'xxxx'
body: 'xxxx'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| title | The title of the new issue | string | ✖ | v1 |
| body | The body of the new issue | string | ✖ | v1 |
| labels | The labels for the new issue | string | ✖ | v1.1 |
| assignees | The assignees for the new issue | string | ✖ | v1.1 |
| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
- `title` default is `Default Title`
- Return `issue-number`. [Usage reference](#outputs-use)
⏫ [Back to list](#List)
#### `delete-comment`
According to [`comment-id`](#comment-id) delete the specified comment.
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| comment-id | The comment ID | number | ✔ | v1 |
⏫ [Back to list](#List)
#### `lock-issue`
When the `invalid` label is added, the issue is locked.
```yml
name: Lock Issue
on:
issues:
types: [labeled]
jobs:
lock-issue:
runs-on: ubuntu-latest
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
⏫ [Back to list](#List)
#### `open-issue`
Open the specified issue.
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
⏫ [Back to list](#List)
#### `remove-assignees`
Remove the person designated by issue.
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xx'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ | v1.1 |
⏫ [Back to list](#List)
#### `remove-labels`
Remove the specified labels.
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.2
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1.2 |
| token | [Token explain](#token) | string | ✔ | v1.2 |
| issue-number | The number of issue | number | ✔ | v1.2 |
| labels | The removed labels. When it is a blank character, do not remove | string | ✔ | v1.2 |
- `labels` supports multiple, such as `x1,x2,x3`, only the labels added by the issue will be removed
⏫ [Back to list](#List)
#### `set-labels`
Replace the labels of issue.
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| labels | labels set. When empty characters, will remove all | string | ✔ | v1.1 |
⏫ [Back to list](#List)
#### `unlock-issue`
Unlock the specified issue.
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
⏫ [Back to list](#List)
#### `update-comment`
Update the specified comment according to [`comment-id`](#comment-id).
The following example shows that 👀 is added for each new comment.
```yml
name: Add eyes to each comment
on:
issue_comment:
types: [created]
jobs:
update-comment:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
contents: 'eyes'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| comment-id | The comment ID | number | ✔ | v1 |
| body | Update the content of comment | string | ✖ | v1 |
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
- When `body` is not entered, it will remain as it is
- When `update-mode` is `append`, additional operations will be performed. Anything other than `append` will be replaced. Only effective for `body`
⏫ [Back to list](#List)
#### `update-issue`
Update the specified issue according to the `issue-number`.
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
state: 'open'
title: 'xxx'
body: 'xxxx'
update-mode: 'replace'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| state | Modify the status of issue, optional value `open` `closed` | string | ✖ | v1 |
| title | Modify the title of the issue | string | ✖ | v1 |
| body | Modify the content of issue | string | ✖ | v1 |
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
| labels | Replace the labels of issue | string | ✖ | v1.1 |
| assignees | Replace the assignees of issue | string | ✖ | v1.1 |
| contents | Add [reaction](#reactions-types) | string | ✖ | v1.1 |
- `state` defaults to `open`
- When the option is not filled, it will keep the original
⏫ [Back to list](#List)
#### `welcome`
When an issue is created, the user who created the issue for the first time is welcome.
If the user is not creating for the first time, there is no operation.
```yml
name: Issue Welcome
on:
issues:
types: [opened]
jobs:
issue-welcome:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.3
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
body: hi @${{ github.event.issue.user.login }}, welcome!
labels: 'welcome1, welcome2'
assignees: 'xx1'
issue-contents: '+1, -1, eyes'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1.3 |
| token | [Token explain](#token) | string | ✔ | v1.3 |
| body | Comment on the welcome content, no comment if you leave it blank | string | ✖ | v1.3 |
| labels | Add labels to this issue | string | ✖ | v1.3 |
| assignees | Add assignees to this issue | string | ✖ | v1.3 |
| issue-contents | Add [reaction](#reactions-types) to this issue| string | ✖ | v1.3 |
- If these 4 options are not filled, no operation
⏫ [Back to list](#List)
### 🌟 Advanced
Advanced usage is not recommended to use multiple actions at the same time.
#### `check-inactive`
At UTC 0 on the 1st of each month, add the `inactive` tag to all issues that have not been active for more than 30 days.
```yml
name: Check inactive
on:
schedule:
- cron: "0 0 1 * *"
jobs:
check-inactive:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-label | The label name adding | string | ✖ | v1 |
- `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-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
⏫ [Back to list](#List)
#### `check-issue`
Check whether the issue meets the conditions according to the passed parameters and `issue-number`, and return a boolean value.
The effect of the following example is: when an issue is newly opened, verify whether the current issue designator contains `x1` or `x2`.
If one designated person is satisfied, the verification will pass, and at the same time, verify whether the title meets the conditions.
[Check rules](#check-rules)
```yml
name: Check Issue
on:
issues:
types: [edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignee-includes: 'x1,x2'
title-includes: 'x1,x2/y1,y2'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1.2 |
| token | [Token explain](#token) | string | ✔ | v1.2 |
| issue-number | The number of issue | number | ✔ | v1.2 |
| assignee-includes | Assignees contains check | string | ✖ | v1.2 |
| title-includes | Title contains check | string | ✖ | v1.2 |
| body-includes | Body contains check | string | ✖ | v1.2 |
- `title-includes` `body-includes` supports the format `x1,x2` or `x1,x2/y1,y2`. Only supports two levels
- Return `check-result`
⏫ [Back to list](#List)
#### `close-issues`
Every 7 days at UTC 0, close the issues that have been filled with the `need info` label and have not been active for more than 7 days.
```yml
name: Check need info
on:
schedule:
- cron: "0 0 */7 * *"
jobs:
check-need-info:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need info'
inactive-day: 7
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
⏫ [Back to list](#List)
#### `find-comments`
Find the current warehouse issue No. 1, the creator is k and the content contains the comment list of `this`.
```yml
- name: Find comments
uses: actions-cool/issues-helper@v1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: 1
comment-auth: 'k'
body-includes: 'this'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| comment-auth | Comment creator, all will be queried if not filled | string | ✖ | v1 |
| body-includes | Comment content includes filtering, no verification if not filled | string | ✖ | v1 |
| direction | Return `comments` sort | string | ✖ | v1 |
- Return `comments` in the following format:
```js
[
{id: 1, auth: 'x', body: 'xxx', created: '', updated: ''},
{id: 2, auth: 'x', body: 'xxx', created: '', updated: ''},
]
```
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
⏫ [Back to list](#List)
#### `lock-issues`
Every 3 months at UTC 0 on the 1st, lock all issues that have been filled with the `inactive` label and have not been active for more than 128 days.
```yml
name: Lock inactive issues
on:
schedule:
- cron: "0 0 1 */3 *"
jobs:
lock-issues:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'inactive'
inactive-day: 128
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
- `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-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
⏫ [Back to list](#List)
## 🌰 Example
Flexible reference.
### `find-comments + create-comment + update-comment`
Hypothetical scenario: When the issue modification of the `watch` label is added, find out whether there is a comment containing `error` created by k, if there is only one, update the comment, if not, add a new comment.
```yml
name: Test
on:
isssue:
types: [edited]
jobs:
do-test:
runs-on: ubuntu-latest
if: github.event.label.name == 'watch'
steps:
- name: find comments
uses: actions-cool/issues-helper@v1
id: fcid
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
comment-auth: k
body-includes: 'error'
- name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: 'Some error!'
- name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.fcid.outputs.comments[0].id }}
body: 'Some error again!'
update-mode: 'append'
```
⏫ [Back to list](#List)
## 🎁 Reference
### token
Need to have the person token with push permission.
- [Personal token application](https://github.com/settings/tokens)
- Need to check `Full control of private repositories`
- Project add secrets
- Select settings, select secrets, select `New repository secret`
- `Name` is the same as in actions
- `Value` fill in the token just applied by the individual
When the token is not filled in actions or the corresponding secrets are not added to the project, it will default to github-actions <kbd>bot</kbd>. [More](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow).
⏫ [Back to list](#List)
### `outputs` use
```yml
- name: Create issue
uses: actions-cool/issues-helper@v1
id: createissue
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check outputs
run: echo "Outputs issue_number is ${{ steps.createissue.outputs.issue-number }}"
```
[More](https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs).
### GitHub Docs
- [Workflow syntax for GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
⏫ [Back to list](#List)
### Check rules
```js
"title-includes": 'x1,x2'
x1
x2
"x1y3y2" true
"y2 x1" true
"x2" true
"x3" false
```
```js
"title-includes": 'x1,x2/y1,y2'
x1 + y1
x2 + y1
x1 + y2
x2 + y2
"x1y3y2" true
"y2 x1" true
"1x2y" false
"x1" false
```
⏫ [Back to list](#List)
### Reactions types
| content | emoji |
| -- | -- |
| `+1` | 👍 |
| `-1` | 👎 |
| `laugh` | 😄 |
| `confused` | 😕 |
| `heart` | ❤️ |
| `hooray` | 🎉 |
| `rocket` | 🚀 |
| `eyes` | 👀 |
⏫ [Back to list](#List)
### `comment-id`
Click the `···` icon in the upper right corner of a comment, select `Copy link`, and the number at the end of the url is `comment_id`.
⏫ [Back to list](#List)
## Actions 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
## 💖 Who is using?
You can come to the following repositories for reference. Please leave a message at [**here**](https://github.com/actions-cool/issues-helper/issues/6).
At the same time, if you have any questions during use, you can also ask and inquire in the issue or discussion.
<table>
<tr>
<td align="center">
<a href="https://github.com/ant-design/ant-design">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/vueComponent/ant-design-vue">
<img src="https://avatars2.githubusercontent.com/u/32120805?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/umijs/dumi">
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/umijs/umi">
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/AttoJS/vue-request">
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
</a>
</td>
</tr>
<tr>
<td align="center" wdith="160">
<strong>ant-design</strong>
</td>
<td align="center" wdith="160">
<strong>ant-design-vue</strong>
</td>
<td align="center" wdith="160">
<strong>dumi</strong>
</td>
<td align="center" wdith="160">
<strong>umi</strong>
</td>
<td align="center" wdith="160">
<strong>vue-request</strong>
</td>
</tr>
</table>
## LICENSE
[MIT](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)

661
README.md
View File

@@ -1,22 +1,32 @@
# 🤖 Issues Helper
# 🤖 Issues 助手
English | [简体中文](./README.zh-CN.md)
简体中文 | [English](./README.en-US.md)
[![](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/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers) [![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/releases) [![](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/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)
[![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi)
[![](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/license/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
A GitHub Action to help you deal with issues
一个轻松帮你自动管理 issues 的 GitHub Action
## 😎 Why use GitHub Action?
[在线文档](https://actions-cool.github.io/issues-helper/) | [更新日志](https://actions-cool.github.io/issues-helper/changelog)
1. Complete free.
2. Fully automatic.
3. Hosted on the GitHub server, as long as GitHub is not down, it will keep running.
## 😎 为什么用 GitHub Action
> Private projects have a limit of 2000 times per month, [Specific view](https://github.com/settings/billing). Public are unlimited.
1. 完全免费
2. 全自动操作
3. 托管于 GitHub 服务器,只要 GitHub 不宕机,它就不受影响
## List
> Private 项目每月有 2000 次的限制,[具体查看](https://github.com/settings/billing)。Public 项目无限制。
- ⭐ Base
## 列 表
当以下列表没有你想要的功能时,可以在 [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18) 中提出。
- ⭐ 基 础
- [`add-assignees`](#add-assignees)
- [`add-labels`](#add-labels)
- [`close-issue`](#close-issue)
@@ -26,27 +36,30 @@ A GitHub Action to help you deal with issues
- [`lock-issue`](#lock-issue)
- [`open-issue`](#open-issue)
- [`remove-assignees`](#remove-assignees)
- [`remove-labels`](#remove-labels)
- [`set-labels`](#set-labels)
- [`unlock-issue`](#unlock-issue)
- [`update-comment`](#update-comment)
- [`update-issue`](#update-issue)
- ⭐ Advanced
- [`welcome`](#welcome)
- ⭐ 进 阶
- [`check-inactive`](#check-inactive)
- [`check-issue`](#check-issue)
- [`close-issues`](#close-issues)
- [`find-comments`](#find-comments)
- [`lock-issues`](#lock-issues)
- 🌰 Example
- 🌰 例 子
- [`find-comments + create-comment + update-comment`](#find-comments--create-comment--update-comment)
## 🚀 Usage
## 🚀 使 用
### ⭐ Base
### ⭐ 基 础
In order to better display the function, the following is an example of the actual scene, please refer to it flexibly.
为了更好的展示功能,下面以实际场景举例,请灵活参考。
#### `add-assignees`
When an issue is added or modified, assign this issue to one or more people.
当一个 issue 新增或修改时,将这个 issue 指定某人或多人。
```yml
name: Add Assigness
@@ -65,26 +78,27 @@ jobs:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or ['xxx'] or ['xx1', 'xx2']
assignees: 'xxx' or 'xx1,xx2'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| assignees | Designated person. No operation when no input or empty character or empty array | string \| string\[] | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | v1.1 |
- `actions` support multiple and separated by comma. Like: `add-assignees,add-labels`
- The `name` can be modified according to the actual situation
- [on reference](#github-docs)
- `${{ github.event.issue.number }}` is the current issue. [More references](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改
- [on 参考](#github-docs)
- `${{ github.event.issue.number }}` 表示当前 issue[更多参考](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
- `assignees` 支持多个需用逗号隔开。注意设置多个需使用v1.1以上版本
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `add-labels`
When the content of a new issue does not contain the specified format, add labels for the issue.
当一个新增的 issue 内容不包含指定格式时,为这个 issue 添加 labels。
```yml
name: Add Labels
@@ -104,21 +118,23 @@ jobs:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug' or ['bug'] or ['bug1', 'bug2']
labels: 'bug' or 'bug1,bug2'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| labels | New labels. When it is not filled in or is empty character, empty array, do not add | string \| string\[] | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| labels | 新增的 labels。当不填或者为空字符时,不新增 | string | ✖ | v1.1 |
⏫ [Back to list](#List)
- `labels` 支持多个需用逗号隔开。注意设置多个需使用v1.1以上版本
⏫ [返回列表](#列-表)
#### `close-issue`
Close the specified issue.
关闭指定 issue
```yml
- name: Close issue
@@ -130,17 +146,17 @@ Close the specified issue.
body: 'This is auto closed.'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `create-comment`
When a designated label is added, comment on the issue.
当新增一个指定 label 时,对该 issue 进行评论。
```yml
name: Create Comment
@@ -161,30 +177,31 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Add some comments.
Hello ${{ github.event.issue.user.login }}. Add some comments.
你好 @${{ github.event.issue.user.login }}。巴拉巴拉。
contents: '+1' or ['+1', 'heart']
你好 ${{ github.event.issue.user.login }}。巴拉巴拉。
contents: '+1' or '+1,heart'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| body | Add comment content | string | ✖ | v1 |
| contents | Add [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| body | 新增评论的内容 | string | ✖ | v1 |
| contents | 为新增评论的增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
- `body` default is `Currently at ${owner}/${repo}. And this is default comment.`
- Where `${owner}/${repo}` means the current repo
- Return `comment-id`, which can be used for subsequent operations. [Usage reference](#outputs-use)
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
- `body` 默认为:`Currently at ${owner}/${repo}. And this is default comment.`
- 其中 `${owner}/${repo}` 表示当前仓库
- 返回 `comment-id`,可用于之后操作。[用法参考](#outputs-使用)
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
- `contents` 支持多个需用逗号隔开。注意设置多个需使用v1.1以上版本
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `create-issue`
Here is an example, add an issue at UTC 00:00 on the 1st of every month.
感觉新增 issue 使用场景不多。这里举例,每月 1 号 UTC 00:00 新增一个 issue。
```yml
name: Create Issue
@@ -209,24 +226,24 @@ jobs:
contents: '+1'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| title | The title of the new issue | string | ✖ | v1 |
| body | The body of the new issue | string | ✖ | v1 |
| labels | The labels for the new issue | string \| string\[] | ✖ | v1 |
| assignees | The assignees for the new issue | string \| string\[] | ✖ | v1 |
| contents | Add [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| title | 新增 issue 的标题 | string | ✖ | v1 |
| body | 新增 issue 的内容 | string | ✖ | v1 |
| labels | 为新增 issue 添加 labels | string | ✖ | v1.1 |
| assignees | 为新增 issue 添加 assignees | string | ✖ | v1.1 |
| contents | 为新增 issue 增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
- `title` default is `Default Title`
- Return `issue-number`. [Usage reference](#outputs-use)
- `title` 默认为:`Default Title`
- 返回 `issue-number`[用法参考](#outputs-使用)
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `delete-comment`
According to [`comment-id`](#comment-id) delete the specified comment.
根据 [`comment-id`](#comment-id) 删除指定评论。
```yml
- name: Delete comment
@@ -237,17 +254,17 @@ According to [`comment-id`](#comment-id) delete the specified comment.
comment-id: xxx
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| comment-id | The comment ID | number | ✔ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| comment-id | 指定的 comment | number | ✔ | v1 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `lock-issue`
When the `invalid` label is added, the issue is locked.
当新增 `invalid` label 时,对该 issue 进行锁定。
```yml
name: Lock Issue
@@ -269,17 +286,17 @@ jobs:
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `open-issue`
Open the specified issue.
打开指定 issue
```yml
- name: Open issue
@@ -290,17 +307,17 @@ Open the specified issue.
issue-number: xxx
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `remove-assignees`
Remove the person designated by issue.
移除 issue 指定人员。
```yml
- name: Remove assignees
@@ -312,18 +329,43 @@ Remove the person designated by issue.
assignees: 'xx'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| assignees | Designated person removed. When it is an empty character, empty array, do not remove | string \| string\[] | ✔ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ | v1.1 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `remove-labels`
移除指定 labels。
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.2
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1.2 |
| token | [token 说明](#token) | string | ✔ | v1.2 |
| issue-number | 指定的 issue | number | ✔ | v1.2 |
| labels | 移除的 labels。当为空字符时不进行移除 | string | ✔ | v1.2 |
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
⏫ [返回列表](#列-表)
#### `set-labels`
Replace the labels of issue.
替换 issue 的 labels。
```yml
- name: Set labels
@@ -335,18 +377,18 @@ Replace the labels of issue.
labels: 'xx'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| labels | labels set. When empty characters, empty array, will remove all | string \| string\[] | ✔ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| labels | labels 设置。当空字符时,会移除所有 | string | ✔ | v1.1 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `unlock-issue`
Unlock the specified issue.
解锁指定 issue
```yml
- name: Unlock issue
@@ -357,19 +399,19 @@ Unlock the specified issue.
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `update-comment`
Update the specified comment according to [`comment-id`](#comment-id).
根据 [`comment-id`](#comment-id) 更新指定评论。
The following example shows that 👀 is added for each new comment.
下面的例子展示的是,为每个新增的 comment 增加 👀 。
```yml
name: Add eyes to each comment
@@ -391,23 +433,23 @@ jobs:
contents: 'eyes'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| comment-id | The comment ID | number | ✔ | v1 |
| body | Update the content of comment | string | ✖ | v1 |
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
| contents | Add [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| comment-id | 指定的 comment | number | ✔ | v1 |
| body | 更新 comment 的内容 | string | ✖ | v1 |
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
| contents | 增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
- When `body` is not entered, it will remain as it is
- When `update-mode` is `append`, additional operations will be performed. Anything other than `append` will be replaced. Only effective for `body`
- `body` 不填时,会保持原有
- `update-mode` `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `update-issue`
Update the specified issue according to the `issue-number`.
根据 `issue-number` 更新指定 issue。
```yml
- name: Update issue
@@ -425,31 +467,70 @@ Update the specified issue according to the `issue-number`.
contents: '+1'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| state | Modify the status of issue, optional value `open` `closed` | string | ✖ | v1 |
| title | Modify the title of the issue | string | ✖ | v1 |
| body | Modify the content of issue | string | ✖ | v1 |
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
| labels | Replace the labels of issue | string \| string\[] | ✖ | v1 |
| assignees | Replace the assignees of issue | string \| string\[] | ✖ | v1 |
| contents | Add [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| state | 修改 issue 的状态,可选值 `open` `closed` | string | ✖ | v1 |
| title | 修改 issue 的标题 | string | ✖ | v1 |
| body | 修改 issue 的内容 | string | ✖ | v1 |
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
| labels | 替换 issue 的 labels | string | ✖ | v1.1 |
| assignees | 替换 issue 的 assignees | string | ✖ | v1.1 |
| contents | 增加 [reaction](#reactions-types) | string | ✖ | v1.1 |
- `state` defaults to `open`
- When the option is not filled, it will keep the original
- `state` 默认为 `open`
- 当可选项不填时,会保持原有
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
### ⭐ Advanced
#### `welcome`
It is not recommended to use multiple actions for advanced usage.
当一个 issue 新建时,对首次新建 issue 的用户进行欢迎。若用户非首次新建,则无操作。
```yml
name: Issue Welcome
on:
issues:
types: [opened]
jobs:
issue-welcome:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.3
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
body: hi @${{ github.event.issue.user.login }}, welcome!
labels: 'welcome1, welcome2'
assignees: 'xx1'
issue-contents: '+1, -1, eyes'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1.3 |
| token | [token 说明](#token) | string | ✔ | v1.3 |
| body | 评论欢迎的内容,不填则不评论 | string | ✖ | v1.3 |
| labels | 为该 issue 增加 labels | string | ✖ | v1.3 |
| assignees | 为该 issue 增加 assignees | string | ✖ | v1.3 |
| issue-contents | 为该 issue 增加 [reaction](#reactions-types) | string | ✖ | v1.3 |
- 若这 4 个可选项都不填,则无操作
⏫ [返回列表](#列-表)
### 🌟 进 阶
进阶用法不建议 actions 多个一次同时使用。
#### `check-inactive`
At UTC 0 on the 1st of each month, add the `inactive` tag to all issues that have not been active for more than 30 days.
每月 1 号 UTC 0 时,对所有 30 天以上未活跃的 issues 增加 `inactive` 标签。
```yml
name: Check inactive
@@ -470,30 +551,73 @@ jobs:
inactive-day: 30
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string \| string\[] | ✖ | v1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1 |
| inactive-label | The label name adding | string | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-label | 新增标签名称 | string | ✖ | v1 |
- `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-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
⏫ [返回列表](#列-表)
#### `check-issue`
根据传入的参数和 `issue-number` 来检查该 issue 是否满足条件,返回一个布尔值。
下面的例子效果是:当 issue 新开时,校验当前 issue 指定人是否包含 `x1` 或者 `x2`,满足一个指定人即可校验通过,同时校验标题是否满足条件,[校验规则](#校验规则)。
```yml
name: Check Issue
on:
issues:
types: [edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignee-includes: 'x1,x2'
title-includes: 'x1,x2/y1,y2'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1.2 |
| token | [token 说明](#token) | string | ✔ | v1.2 |
| issue-number | 指定的 issue | number | ✔ | v1.2 |
| assignee-includes | 是否包含指定人 | string | ✖ | v1.2 |
| title-includes | 标题包含校验 | string | ✖ | v1.2 |
| body-includes | 内容包含校验 | string | ✖ | v1.2 |
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
- 返回 `check-result`
⏫ [返回列表](#列-表)
#### `close-issues`
Every 7 days at UTC 0, close the issues that have been filled with the `need info` label and have not been active for more than 7 days.
每 7 天 UTC 0 时,关闭已填加 `need info` label 且 7 天以上未活跃的 issues。
```yml
name: Check need info
@@ -515,28 +639,28 @@ jobs:
inactive-day: 7
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string \| string\[] | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `find-comments`
Find the current warehouse issue No. 1, the creator is k and the content contains the comment list of `this`.
查找当前仓库 1 号 issue 中,创建者是 k ,内容包含 `this` 的评论列表。
```yml
- name: Find comments
@@ -549,16 +673,16 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
body-includes: 'this'
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| comment-auth | Comment creator, all will be queried if not filled | string | ✖ | v1 |
| body-includes | Comment content includes filtering, no verification if not filled | string | ✖ | v1 |
| direction | Return `comments` sort | string | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ | v1 |
| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ | v1 |
| direction | 返回 `comments` 排序 | string | ✖ | v1 |
- Return `comments` in the following format:
- 返回 `comments`,格式如下:
```js
[
@@ -567,14 +691,14 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
]
```
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
#### `lock-issues`
Every 3 months at UTC 0 on the 1st, lock all issues that have been filled with the `inactive` label and have not been active for more than 128 days.
每 3 个月 1 号 UTC 0 时,锁定已填加 `inactive` label 且 128 天以上未活跃的所有 issues。
```yml
name: Lock inactive issues
@@ -596,34 +720,34 @@ jobs:
inactive-day: 128
```
| Param | Desc | Type | Required | Version |
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](#token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string \| string\[] | ✖ | v1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1 |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
- `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-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
## 🌰 Example
## 🌰 例 子
Flexible reference.
灵活参考。
### `find-comments + create-comment + update-comment`
Hypothetical scenario: When the issue modification of the `watch` label is added, find out whether there is a comment containing `error` created by k, if there is only one, update the comment, if not, add a new comment.
假设场景:当添加了 `watch` label 的 issue 修改时,查找是否有 k 创建的包含 `error` 的评论,如果只有一个,则更新该 comment如果没有则新增一个 comment
```yml
name: Test
@@ -667,26 +791,26 @@ jobs:
update-mode: 'append'
```
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
## 🎁 Reference
## 🎁 参 考
### token
Need to have the person token with push permission.
需拥有 push 权限的人员 token。
- [Personal token application](https://github.com/settings/tokens)
- Need to check `Full control of private repositories`
- Project add secrets
- Select settings, select secrets, select `New repository secret`
- `Name` is the same as in actions
- `Value` fill in the token just applied by the individual
- [个人 token 申请](https://github.com/settings/tokens)
- 需勾选 `Full control of private repositories`
- 项目添加 secrets
- 选择 settings,选择 secrets选择 `New repository secret`
- `Name` actions 中保持一致
- `Value` 填写刚才个人申请的 token
When the token is not filled in actions or the corresponding secrets are not added to the project, it will default to github-actions <kbd>bot</kbd>.
当 actions 不填写 token 时,或项目未添加对应 secrets 时,会默认为 github-actions <kbd>bot</kbd>。[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow)。
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
### `outputs` use
### `outputs` 使用
```yml
- name: Create issue
@@ -699,14 +823,46 @@ When the token is not filled in actions or the corresponding secrets are not add
run: echo "Outputs issue_number is ${{ steps.createissue.outputs.issue-number }}"
```
[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs)。
### GitHub Docs
- [Workflow syntax for GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
- [GitHub Actions 语法](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
### Reactions types
### 校验规则
```js
"title-includes": 'x1,x2'
x1
x2
"x1y3y2" true
"y2 x1" true
"x2" true
"x3" false
```
```js
"title-includes": 'x1,x2/y1,y2'
x1 + y1
x2 + y1
x1 + y2
x2 + y2
"x1y3y2" true
"y2 x1" true
"1x2y" false
"x1" false
```
⏫ [返回列表](#列-表)
### Reactions 类型
| content | emoji |
| -- | -- |
@@ -719,21 +875,72 @@ When the token is not filled in actions or the corresponding secrets are not add
| `rocket` | 🚀 |
| `eyes` | 👀 |
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
### `comment-id`
Click the `···` icon in the upper right corner of a comment, select `Copy link`, and the number at the end of the url is `comment_id`.
点击某个评论右上角 `···` 图标,选择 `Copy link`url 末尾数字即是 `comment_id`
⏫ [Back to list](#List)
⏫ [返回列表](#列-表)
## Actions Template
## Actions 模板
[GitHub Actions workflow template](https://github.com/actions-cool/.github). After fork, you can use the template directly.
- 可直接使用这个 [GitHub Actions workflow template](https://github.com/actions-cool/.github) 仓库的模板
## 💖 Who are using?
- 个人练习和测试 [Actions](https://github.com/xrkffgg/test-ci) 的仓库
You can come to the following reference template. Please leave a message at [**here** ](https://github.com/actions-cool/issues-helper/issues/6).
## 💖 谁在使用?
你可以来以下项目进行参考。欢迎在 [**这里**](https://github.com/actions-cool/issues-helper/issues/6) 留言。
同时,如果你在使用过程中有什么疑问,也可以在 issue 或者 discussion 中进行提问和查询。
<table>
<tr>
<td align="center">
<a href="https://github.com/ant-design/ant-design">
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/vueComponent/ant-design-vue">
<img src="https://avatars2.githubusercontent.com/u/32120805?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/umijs/dumi">
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/umijs/umi">
<img src="https://avatars2.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
</a>
</td>
<td align="center">
<a href="https://github.com/AttoJS/vue-request">
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
</a>
</td>
</tr>
<tr>
<td align="center" wdith="160">
<strong>ant-design</strong>
</td>
<td align="center" wdith="160">
<strong>ant-design-vue</strong>
</td>
<td align="center" wdith="160">
<strong>dumi</strong>
</td>
<td align="center" wdith="160">
<strong>umi</strong>
</td>
<td align="center" wdith="160">
<strong>vue-request</strong>
</td>
</tr>
</table>
## LICENSE

View File

@@ -1,740 +0,0 @@
# 🤖 Issues Helper
[English](./README.md) | 简体中文
[![](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/stars/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/stargazers) [![](https://img.shields.io/github/v/release/actions-cool/issues-helper?style=flat-square)](https://github.com/actions-cool/issues-helper/releases) [![](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
## 😎 为什么用 GitHub Action
1. 完全免费。
2. 全自动操作。
3. 托管于 GitHub 服务器,只要 GitHub 不宕机,它就会一直跑下去。
> Private 项目每月有 2000 次的限制,[具体查看](https://github.com/settings/billing)。Public 项目无限制。
## 列 表
- ⭐ 基 础
- [`add-assignees`](#add-assignees)
- [`add-labels`](#add-labels)
- [`close-issue`](#close-issue)
- [`create-comment`](#create-comment)
- [`create-issue`](#create-issue)
- [`delete-comment`](#delete-comment)
- [`lock-issue`](#lock-issue)
- [`open-issue`](#open-issue)
- [`remove-assignees`](#remove-assignees)
- [`set-labels`](#set-labels)
- [`unlock-issue`](#unlock-issue)
- [`update-comment`](#update-comment)
- [`update-issue`](#update-issue)
- ⭐ 进 阶
- [`check-inactive`](#check-inactive)
- [`close-issues`](#close-issues)
- [`find-comments`](#find-comments)
- [`lock-issues`](#lock-issues)
- 🌰 例 子
- [`find-comments + create-comment + update-comment`](#find-comments--create-comment--update-comment)
## 🚀 使 用
### ⭐ 基 础
为了更好的展示功能,下面以实际场景举例,请灵活参考。
#### `add-assignees`
当一个 issue 新增或修改时,将这个 issue 指定某人或多人。
```yml
name: Add Assigness
on:
issues:
types: [opened, edited]
jobs:
add-assigness:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or ['xxx'] or ['xx1', 'xx2']
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| assignees | 指定人。当不填或者为空字符、空数组时,不操作 | string \| string\[] | ✖ | v1 |
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改
- [on 参考](#github-docs)
- `${{ github.event.issue.number }}` 表示当前 issue[更多参考](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
⏫ [返回列表](#列-表)
#### `add-labels`
当一个新增的 issue 内容不包含指定格式时,为这个 issue 添加 labels。
```yml
name: Add Labels
on:
issues:
types: [opened]
jobs:
add-labels:
runs-on: ubuntu-latest
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug' or ['bug'] or ['bug1', 'bug2']
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| labels | 新增的 labels。当不填或者为空字符、空数组时不新增 | string \| string\[] | ✖ | v1 |
⏫ [返回列表](#列-表)
#### `close-issue`
关闭指定 issue。
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
body: 'This is auto closed.'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [返回列表](#列-表)
#### `create-comment`
当新增一个指定 label 时,对该 issue 进行评论。
```yml
name: Create Comment
on:
issues:
types: [labeled]
jobs:
create-comment:
runs-on: ubuntu-latest
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello ${{ github.event.issue.user.login }}. Add some comments.
你好 ${{ github.event.issue.user.login }}。巴拉巴拉。
contents: '+1' or ['+1', 'heart']
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| body | 新增评论的内容 | string | ✖ | v1 |
| contents | 为新增评论的增加 [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
- `body` 默认为:`Currently at ${owner}/${repo}. And this is default comment.`
- 其中 `${owner}/${repo}` 表示当前仓库
- 返回 `comment-id`,可用于之后操作。[用法参考](#outputs-使用)
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
⏫ [返回列表](#列-表)
#### `create-issue`
感觉新增 issue 使用场景不多。这里举例,每月 1 号 UTC 00:00 新增一个 issue。
```yml
name: Create Issue
on:
schedule:
- cron: "0 0 1 * *"
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: 'xxxx'
body: 'xxxx'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| title | 新增 issue 的标题 | string | ✖ | v1 |
| body | 新增 issue 的内容 | string | ✖ | v1 |
| labels | 为新增 issue 添加 labels | string \| string\[] | ✖ | v1 |
| assignees | 为新增 issue 添加 assignees | string \| string\[] | ✖ | v1 |
| contents | 为新增 issue 增加 [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
- `title` 默认为:`Default Title`
- 返回 `issue-number`[用法参考](#outputs-使用)
⏫ [返回列表](#列-表)
#### `delete-comment`
根据 [`comment-id`](#comment-id) 删除指定评论。
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| comment-id | 指定的 comment | number | ✔ | v1 |
⏫ [返回列表](#列-表)
#### `lock-issue`
当新增 `invalid` label 时,对该 issue 进行锁定。
```yml
name: Lock Issue
on:
issues:
types: [labeled]
jobs:
lock-issue:
runs-on: ubuntu-latest
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [返回列表](#列-表)
#### `open-issue`
打开指定 issue。
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [返回列表](#列-表)
#### `remove-assignees`
移除 issue 指定人员。
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xx'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| assignees | 移除的指定人。当为空字符、空数组时,不进行移除 | string \| string\[] | ✔ | v1 |
⏫ [返回列表](#列-表)
#### `set-labels`
替换 issue 的 labels。
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| labels | labels 设置。当空字符、空数组时,会移除所有 | string \| string\[] | ✔ | v1 |
⏫ [返回列表](#列-表)
#### `unlock-issue`
解锁指定 issue。
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
⏫ [返回列表](#列-表)
#### `update-comment`
根据 [`comment-id`](#comment-id) 更新指定评论。
下面的例子展示的是,为每个新增的 comment 增加 👀 。
```yml
name: Add eyes to each comment
on:
issue_comment:
types: [created]
jobs:
update-comment:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
contents: 'eyes'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| comment-id | 指定的 comment | number | ✔ | v1 |
| body | 更新 comment 的内容 | string | ✖ | v1 |
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
| contents | 增加 [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
- `body` 不填时,会保持原有
- `update-mode``append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
⏫ [返回列表](#列-表)
#### `update-issue`
根据 `issue-number` 更新指定 issue。
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
state: 'open'
title: 'xxx'
body: 'xxxx'
update-mode: 'replace'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| state | 修改 issue 的状态,可选值 `open` `closed` | string | ✖ | v1 |
| title | 修改 issue 的标题 | string | ✖ | v1 |
| body | 修改 issue 的内容 | string | ✖ | v1 |
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
| labels | 替换 issue 的 labels | string \| string\[] | ✖ | v1 |
| assignees | 替换 issue 的 assignees | string \| string\[] | ✖ | v1 |
| contents | 增加 [reaction](#reactions-types) | string \| string\[] | ✖ | v1 |
- `state` 默认为 `open`
- 当可选项不填时,会保持原有
⏫ [返回列表](#列-表)
### ⭐ 进 阶
进阶用法不建议 actions 多重使用。
#### `check-inactive`
每月 1 号 UTC 0 时,对所有 30 天以上未活跃的 issues 增加 `inactive` 标签。
```yml
name: Check inactive
on:
schedule:
- cron: "0 0 1 * *"
jobs:
check-inactive:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string \| string\[] | ✖ | v1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1 |
| inactive-label | 新增标签名称 | string | ✖ | v1 |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
#### `close-issues`
每 7 天 UTC 0 时,关闭已填加 `need info` label 且 7 天以上未活跃的 issues。
```yml
name: Check need info
on:
schedule:
- cron: "0 0 */7 * *"
jobs:
check-need-info:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need info'
inactive-day: 7
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string \| string\[] | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1 |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
⏫ [返回列表](#列-表)
#### `find-comments`
查找当前仓库 1 号 issue 中,创建者是 k ,内容包含 `this` 的评论列表。
```yml
- name: Find comments
uses: actions-cool/issues-helper@v1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: 1
comment-auth: 'k'
body-includes: 'this'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ | v1 |
| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ | v1 |
| direction | 返回 `comments` 排序 | string | ✖ | v1 |
- 返回 `comments`,格式如下:
```js
[
{id: 1, auth: 'x', body: 'xxx', created: '', updated: ''},
{id: 2, auth: 'x', body: 'xxx', created: '', updated: ''},
]
```
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
⏫ [返回列表](#列-表)
#### `lock-issues`
每 3 个月 1 号 UTC 0 时,锁定已填加 `inactive` label 且 128 天以上未活跃的所有 issues。
```yml
name: Lock inactive issues
on:
schedule:
- cron: "0 0 1 */3 *"
jobs:
lock-issues:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'inactive'
inactive-day: 128
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](#token) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string \| string\[] | ✖ | v1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1 |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
⏫ [返回列表](#列-表)
## 🌰 例 子
灵活参考。
### `find-comments + create-comment + update-comment`
假设场景:当添加了 `watch` label 的 issue 修改时,查找是否有 k 创建的包含 `error` 的评论,如果只有一个,则更新该 comment如果没有则新增一个 comment。
```yml
name: Test
on:
isssue:
types: [edited]
jobs:
do-test:
runs-on: ubuntu-latest
if: github.event.label.name == 'watch'
steps:
- name: find comments
uses: actions-cool/issues-helper@v1
id: fcid
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
comment-auth: k
body-includes: 'error'
- name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: 'Some error!'
- name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ steps.fcid.outputs.comments[0].id }}
body: 'Some error again!'
update-mode: 'append'
```
⏫ [返回列表](#列-表)
## 🎁 参 考
### token
需拥有 push 权限的人员 token。
- [个人 token 申请](https://github.com/settings/tokens)
- 需勾选 `Full control of private repositories`
- 项目添加 secrets
- 选择 settings选择 secrets选择 `New repository secret`
- `Name` 与 actions 中保持一致
- `Value` 填写刚才个人申请的 token
当 actions 不填写 token 时,或项目未添加对应 secrets 时,会默认为 github-actions <kbd>bot</kbd>
⏫ [返回列表](#列-表)
### `outputs` 使用
```yml
- name: Create issue
uses: actions-cool/issues-helper@v1
id: createissue
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check outputs
run: echo "Outputs issue_number is ${{ steps.createissue.outputs.issue-number }}"
```
### GitHub Docs
- [GitHub Actions 语法](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
⏫ [返回列表](#列-表)
### Reactions types
| content | emoji |
| -- | -- |
| `+1` | 👍 |
| `-1` | 👎 |
| `laugh` | 😄 |
| `confused` | 😕 |
| `heart` | ❤️ |
| `hooray` | 🎉 |
| `rocket` | 🚀 |
| `eyes` | 👀 |
⏫ [返回列表](#列-表)
### `comment-id`
点击某个评论右上角 `···` 图标,选择 `Copy link`url 末尾数字即是 `comment_id`
⏫ [返回列表](#列-表)
## Actions 模板
[GitHub Actions workflow template](https://github.com/actions-cool/.github) Fork 后,可直接使用模板。
## 💖 谁在使用?
你可以来以下项目参考模版。欢迎在[ **这里** ](https://github.com/actions-cool/issues-helper/issues/6)留言。
## LICENSE
[MIT](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)

View File

@@ -1,9 +1,9 @@
name: 'Issues Helper'
description: 'Some operations on issue'
description: 'A GitHub Action that easily helps you automatically manage issues'
author: 'xrkffgg'
branding:
icon: 'message-square'
color: 'blue'
color: 'black'
inputs:
actions:
description: 'Action name'
@@ -32,6 +32,8 @@ inputs:
description: 'Find comments direction'
comment-auth:
description: 'Find comments query auth'
assignee-includes:
description: 'Check use'
body-includes:
description: 'Query use'
title-includes:
@@ -42,6 +44,8 @@ inputs:
description: 'Query use'
issue-mentioned:
description: 'Query use'
issue-contents:
description: 'For welcome'
issue-state:
description: 'Query use'
inactive-day:
@@ -55,6 +59,8 @@ outputs:
description: 'Create comment ID'
comments:
description: 'Find comments'
check-result:
description: 'Check issue'
runs:
using: node12
main: 'dist/index.js'

372
dist/index.js vendored
View File

@@ -1461,7 +1461,7 @@ exports.Octokit = Octokit;
Object.defineProperty(exports, "__esModule", ({ value: true }));
var isPlainObject = __webpack_require__(3287);
var isPlainObject = __webpack_require__(558);
var universalUserAgent = __webpack_require__(5030);
function lowercaseKeys(object) {
@@ -1849,6 +1849,52 @@ exports.endpoint = endpoint;
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 558:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor,prot;
if (isObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (ctor === undefined) return true;
// If has modified prototype
prot = ctor.prototype;
if (isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
}
exports.isPlainObject = isPlainObject;
/***/ }),
/***/ 8467:
@@ -3361,7 +3407,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
var endpoint = __webpack_require__(9440);
var universalUserAgent = __webpack_require__(5030);
var isPlainObject = __webpack_require__(3287);
var isPlainObject = __webpack_require__(9062);
var nodeFetch = _interopDefault(__webpack_require__(467));
var requestError = __webpack_require__(537);
@@ -3503,6 +3549,52 @@ exports.request = request;
//# sourceMappingURL=index.js.map
/***/ }),
/***/ 9062:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor,prot;
if (isObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (ctor === undefined) return true;
// If has modified prototype
prot = ctor.prototype;
if (isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
}
exports.isPlainObject = isPlainObject;
/***/ }),
/***/ 5375:
@@ -3876,52 +3968,6 @@ module.exports.config = config
module.exports.parse = parse
/***/ }),
/***/ 3287:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObject(o) {
return Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor,prot;
if (isObject(o) === false) return false;
// If has modified constructor
ctor = o.constructor;
if (ctor === undefined) return true;
// If has modified prototype
prot = ctor.prototype;
if (isObject(prot) === false) return false;
// If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
}
// Most likely a plain Object
return true;
}
exports.isPlainObject = isPlainObject;
/***/ }),
/***/ 467:
@@ -5996,6 +6042,8 @@ const {
doLockIssue
} = __webpack_require__(9932);
const { dealInput, matchKeyword } = __webpack_require__(6254);
const token = core.getInput('token');
const octokit = new Octokit({ auth: `token ${token}` });
@@ -6005,6 +6053,7 @@ direction = direction === 'desc' ? 'desc' : 'asc';
const commentAuth = core.getInput("comment-auth");
const bodyIncludes = core.getInput('body-includes');
const titleIncludes = core.getInput('title-includes');
const assigneeIncludes = core.getInput('assignee-includes');
const issueCreator = core.getInput("issue-creator");
const issueAssignee = core.getInput('issue-assignee');
@@ -6038,6 +6087,54 @@ async function doCheckInactive (owner, repo, labels) {
}
};
/**
* 检查 issue 是否满足条件,满足返回 true
* 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
* 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
*/
async function doCheckIssue (owner, repo, issueNumber) {
var checkResult = true;
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber
});
if (!!checkResult && assigneeIncludes) {
let assigneesCheck = dealInput(assigneeIncludes);
let checkAssignee = false;
issue.data.assignees.forEach(it => {
if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) {
checkResult = true;
checkAssignee = true;
}
})
!checkAssignee ? checkResult = false : null;
}
if (!!checkResult && titleIncludes) {
const titleArr = titleIncludes.split('/');
const keyword1 = dealInput(titleArr[0]);
const keyword2 = dealInput(titleArr[1]);
checkResult =
keyword2.length ?
matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) :
matchKeyword(issue.data.title, keyword1);
}
if (!!checkResult && bodyIncludes) {
const bodyArr = bodyIncludes.split('/');
const keyword1 = dealInput(bodyArr[0]);
const keyword2 = dealInput(bodyArr[1]);
checkResult =
keyword2.length ?
matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) :
matchKeyword(issue.data.body, keyword1);
}
core.info(`Actions: [check-issue][${!!checkResult}] success!`);
core.setOutput("check-result", !!checkResult);
};
async function doCloseIssues (owner, repo, labels) {
const issues = await doQueryIssues(owner, repo, labels, 'open');
@@ -6095,7 +6192,7 @@ async function doLockIssues (owner, repo, labels) {
}
};
async function doQueryIssues (owner, repo, labels, state) {
async function doQueryIssues (owner, repo, labels, state, creator) {
let params = {
owner,
repo,
@@ -6107,15 +6204,11 @@ async function doQueryIssues (owner, repo, labels, state) {
issueMentioned ? params.mentioned = issueMentioned : null;
if (labels) {
if (typeof(labels) === 'string') {
params.labels = labels;
} else {
let temp = '';
labels.forEach((it,index) => {
index == labels.length - 1 ? temp += `${it}` : temp += `${it},`;
});
params.labels = temp;
}
params.labels = labels;
}
if (creator) {
params.creator = creator;
}
const res = await octokit.issues.listForRepo(params);
@@ -6123,7 +6216,12 @@ async function doQueryIssues (owner, repo, labels, state) {
res.data.forEach(iss => {
const a = bodyIncludes ? iss.body.includes(bodyIncludes) : true;
const b = titleIncludes ? iss.title.includes(titleIncludes) : true;
if (a && b) {
/**
* Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request.
* For this reason, "Issues" endpoints may return both issues and pull requests in the response.
* You can identify pull requests by the pull_request key.
*/
if (a && b && iss.pull_request === undefined) {
if (inactiveDay && typeof(inactiveDay) === 'number') {
let lastTime = dayjs.utc().subtract(inactiveDay, 'day');
let updateTime = dayjs.utc(iss.updated_at);
@@ -6141,9 +6239,13 @@ async function doQueryIssues (owner, repo, labels, state) {
module.exports = {
doCheckInactive,
doCheckIssue,
doCloseIssues,
doFindComments,
doLockIssues,
// tool
doQueryIssues,
};
@@ -6154,8 +6256,11 @@ module.exports = {
__webpack_require__(2437).config();
const core = __webpack_require__(2186);
const github = __webpack_require__(5438);
const { Octokit } = __webpack_require__(5375);
const { doQueryIssues } = __webpack_require__(9319);
const ALLREACTIONS = [
"+1",
"-1",
@@ -6173,6 +6278,7 @@ const token = core.getInput('token');
const octokit = new Octokit({ auth: `token ${token}` });
const contents = core.getInput("contents");
const issueContents = core.getInput("issue-contents");
async function doAddAssignees (owner, repo, issueNumber, assignees) {
await octokit.issues.addAssignees({
@@ -6215,12 +6321,12 @@ async function doCreateComment (owner, repo, issueNumber, body) {
core.setOutput("comment-id", data.id);
if (contents) {
await doCreateCommentContent(owner, repo, data.id, contents);
await doCreateCommentContent(owner, repo, data.id, dealInput(contents));
}
};
async function doCreateCommentContent(owner, repo, commentId) {
if (typeof(contents) === 'object') {
async function doCreateCommentContent(owner, repo, commentId, contents) {
if (contents.length) {
contents.forEach(async item => {
if (testContent(item)) {
await octokit.reactions.createForIssueComment({
@@ -6232,14 +6338,6 @@ async function doCreateCommentContent(owner, repo, commentId) {
core.info(`Actions: [create-reactions][${item}] success!`);
}
})
} else if (typeof(contents) === 'string' && testContent(contents)) {
await octokit.reactions.createForIssueComment({
owner,
repo,
comment_id: commentId,
content: contents
});
core.info(`Actions: [create-reactions][${contents}] success!`);
}
};
@@ -6258,12 +6356,12 @@ async function doCreateIssue (owner, repo, title, body, labels, assignees) {
core.setOutput("issue-number", data.number);
if (contents) {
await doCreateIssueContent(owner, repo, data.number, contents);
await doCreateIssueContent(owner, repo, data.number, dealInput(contents));
}
};
async function doCreateIssueContent(owner, repo, issueNumber) {
if (typeof(contents) === 'object') {
async function doCreateIssueContent(owner, repo, issueNumber, contents) {
if (contents.length) {
contents.forEach(async item => {
if (testContent(item)) {
await octokit.reactions.createForIssue({
@@ -6275,14 +6373,6 @@ async function doCreateIssueContent(owner, repo, issueNumber) {
core.info(`Actions: [create-reactions][${item}] success!`);
}
})
} else if (typeof(contents) === 'string' && testContent(contents)) {
await octokit.reactions.createForIssue({
owner,
repo,
issue_number: issueNumber,
content: contents
});
core.info(`Actions: [create-reactions][${contents}] success!`);
}
};
@@ -6324,6 +6414,28 @@ async function doRemoveAssignees (owner, repo, issueNumber, assignees) {
core.info(`Actions: [remove-assignees][${assignees}] success!`);
};
async function doRemoveLabels (owner, repo, issueNumber, labels) {
const issue = await octokit.issues.get({
owner,
repo,
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,
repo,
issue_number: issueNumber,
labels: addLables
});
core.info(`Actions: [remove-labels][${labels}] success!`);
}
};
async function doSetLabels (owner, repo, issueNumber, labels) {
await octokit.issues.setLabels({
owner,
@@ -6372,10 +6484,10 @@ async function doUpdateComment (
await octokit.issues.updateComment(params);
core.info(`Actions: [update-comment][${commentId}] success!`);
}
}
if (contents) {
await doCreateCommentContent(owner, repo, commentId, contents);
await doCreateCommentContent(owner, repo, commentId, dealInput(contents));
}
};
@@ -6397,8 +6509,20 @@ async function doUpdateIssue (
})
const issue_body = issue.data.body;
const issue_title = issue.data.title;
const issue_labels = issue.data.labels;
const issue_assignees = issue.data.assignees;
let issue_labels = [];
if (issue.data.labels.length > 0) {
issue.data.labels.forEach(it =>{
issue_labels.push(it.name);
});
}
let issue_assignees = [];
if (issue.data.assignees.length > 0) {
issue.data.assignees.forEach(it =>{
issue_assignees.push(it.login);
});
}
let params = {
owner,
@@ -6432,6 +6556,41 @@ async function doUpdateIssue (
}
};
async function doWelcome (owner, repo, assignees, labels, body) {
const context = github.context;
const isIssue = !!context.payload.issue;
if (!isIssue) {
core.setFailed("The event that triggered this action must be a issue. Error!");
} else {
const auth = context.payload.sender.login;
core.info(`Actions: [welcome: auth=][${auth}]`);
const issueNumber = context.issue.number;
const creator = 'zoo-js-bot';
const issues = await doQueryIssues(owner, repo, false, 'all', creator);
if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) {
if (core.getInput("body")) {
await doCreateComment(owner, repo, issueNumber, body);
} else {
core.info(`Actions: [welcome] no body!`);
}
if (assignees) {
await doAddAssignees(owner, repo, issueNumber, assignees);
}
if (labels) {
await doAddLabels(owner, repo, issueNumber, labels);
}
if (issueContents) {
await doCreateIssueContent(owner, repo, issueNumber, dealInput(issueContents));
}
} else {
core.info(`Actions: [welcome][${auth}] is not first time!`);
}
}
};
// tool
function testContent(con) {
if (ALLREACTIONS.includes(con)) {
@@ -6455,10 +6614,12 @@ module.exports = {
doLockIssue,
doOpenIssue,
doRemoveAssignees,
doRemoveLabels,
doSetLabels,
doUnlockIssue,
doUpdateComment,
doUpdateIssue,
doWelcome,
};
@@ -6482,14 +6643,17 @@ const {
doLockIssue,
doOpenIssue,
doRemoveAssignees,
doRemoveLabels,
doSetLabels,
doUnlockIssue,
doUpdateComment,
doUpdateIssue,
doWelcome,
} = __webpack_require__(9932);
const {
doCheckInactive,
doCheckIssue,
doCloseIssues,
doFindComments,
doLockIssues,
@@ -6506,13 +6670,16 @@ const ALLACTIONS = [
'lock-issue',
'open-issue',
'remove-assignees',
'remove-labels',
'set-labels',
'unlock-issue',
'update-comment',
'update-issue',
'welcome',
// advanced
'check-inactive',
'check-issue',
'close-issues',
'find-comments',
'lock-issues',
@@ -6586,6 +6753,9 @@ async function main() {
case 'remove-assignees':
await doRemoveAssignees(owner, repo, issueNumber, assignees);
break;
case 'remove-labels':
await doRemoveLabels(owner, repo, issueNumber, labels);
break;
case 'set-labels':
await doSetLabels(owner, repo, issueNumber, labels);
break;
@@ -6614,6 +6784,15 @@ async function main() {
labels
);
break;
case 'welcome':
await doWelcome(
owner,
repo,
assignees,
labels,
body
);
break;
// advanced
case 'check-inactive':
@@ -6623,6 +6802,13 @@ async function main() {
labels
)
break;
case 'check-issue':
await doCheckIssue(
owner,
repo,
issueNumber
);
break;
case 'close-issues':
await doCloseIssues(
owner,
@@ -6666,17 +6852,23 @@ main();
function dealInput (para) {
let arr = [];
if (para) {
if (typeof(para) === 'string') {
arr.push(para);
} else {
arr = para;
}
const paraArr = para.split(',');
paraArr.forEach(it => {
if(it.trim()){
arr.push(it.trim())
}
})
}
return arr;
};
function matchKeyword(content, keywords) {
return keywords.find(item => content.toLowerCase().includes(item));
};
module.exports = {
dealInput,
matchKeyword,
};

214
docs/advanced.en-US.md Normal file
View File

@@ -0,0 +1,214 @@
---
toc: menu
---
# 🌟 Advanced
Advanced usage is not recommended to use multiple actions at the same time.
## `check-inactive`
At UTC 0 on the 1st of each month, add the `inactive` tag to all issues that have not been active for more than 30 days.
```yml
name: Check inactive
on:
schedule:
- cron: "0 0 1 * *"
jobs:
check-inactive:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
| inactive-label | The label name adding | string | ✖ | v1 |
- `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-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
- `inactive-label`: The default is `inactive`, others can be customized. When the project does not contain the label, it will be created automatically
## `check-issue`
Check whether the issue meets the conditions according to the passed parameters and `issue-number`, and return a boolean value.
The effect of the following example is: when an issue is newly opened, verify whether the current issue designator contains `x1` or `x2`.
If one designated person is satisfied, the verification will pass, and at the same time, verify whether the title meets the conditions.
[Check rules](/en-US/guide/ref#-includes-check-rules)
```yml
name: Check Issue
on:
issues:
types: [edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignee-includes: 'x1,x2'
title-includes: 'x1,x2/y1,y2'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1.2 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1.2 |
| issue-number | The number of issue | number | ✔ | v1.2 |
| assignee-includes | Assignees contains check | string | ✖ | v1.2 |
| title-includes | Title contains check | string | ✖ | v1.2 |
| body-includes | Body contains check | string | ✖ | v1.2 |
- `title-includes` `body-includes` supports the format `x1,x2` or `x1,x2/y1,y2`. Only supports two levels
- Return `check-result`
## `close-issues`
Every 7 days at UTC 0, close the issues that have been filled with the `need info` label and have not been active for more than 7 days.
```yml
name: Check need info
on:
schedule:
- cron: "0 0 */7 * *"
jobs:
check-need-info:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need info'
inactive-day: 7
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
- `issue-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all
## `find-comments`
Find the current warehouse issue No. 1, the creator is k and the content contains the comment list of `this`.
```yml
- name: Find comments
uses: actions-cool/issues-helper@v1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: 1
comment-auth: 'k'
body-includes: 'this'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| comment-auth | Comment creator, all will be queried if not filled | string | ✖ | v1 |
| body-includes | Comment content includes filtering, no verification if not filled | string | ✖ | v1 |
| direction | Return `comments` sort | string | ✖ | v1 |
- Return `comments` in the following format:
```js
[
{id: 1, auth: 'x', body: 'xxx', created: '', updated: ''},
{id: 2, auth: 'x', body: 'xxx', created: '', updated: ''},
]
```
- `direction` defaults to ascending order, only when `desc` is set, descending order will be returned
- The `created` `updated` in the returned array, determined by the environment, will be UTC +0
## `lock-issues`
Every 3 months at UTC 0 on the 1st, lock all issues that have been filled with the `inactive` label and have not been active for more than 128 days.
```yml
name: Lock inactive issues
on:
schedule:
- cron: "0 0 1 */3 *"
jobs:
lock-issues:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'inactive'
inactive-day: 128
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| body | When operating an issue, you can comment. Do not comment when not typing | string | ✖ | v1 |
| labels | Labels filtering | string | ✖ | v1.1 |
| issue-state | State filtering | string | ✖ | v1 |
| issue-assignee | Assignee filtering | string | ✖ | v1 |
| issue-creator | Creator filtering | string | ✖ | v1 |
| issue-mentioned | Mentioned filtering | string | ✖ | v1 |
| body-includes | Body filtering | string | ✖ | v1 |
| title-includes | Title filtering | string | ✖ | v1 |
| inactive-day | Inactive days filtering | number | ✖ | v1.2 |
- `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-assignee`: Multiplayer is not supported. If you do not enter or enter *, all will be searched. Entering `none` will query issues for which the specified person is not added
- `inactive-day`: When entering, it will filter the issue update time earlier than the current time minus the number of inactive days. If not entered, all

210
docs/advanced.md Normal file
View File

@@ -0,0 +1,210 @@
---
toc: menu
---
# 🌟 进 阶
进阶用法不建议 actions 多个一次同时使用。
## `check-inactive`
每月 1 号 UTC 0 时,对所有 30 天以上未活跃的 issues 增加 `inactive` 标签。
```yml
name: Check inactive
on:
schedule:
- cron: "0 0 1 * *"
jobs:
check-inactive:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v1
with:
actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }}
inactive-day: 30
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
| inactive-label | 新增标签名称 | string | ✖ | v1 |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
- `inactive-label`:默认为 `inactive`,可自定义其他。当项目未包含该 label 时,会自动新建
## `check-issue`
根据传入的参数和 `issue-number` 来检查该 issue 是否满足条件,返回一个布尔值。
下面的例子效果是:当 issue 新开时,校验当前 issue 指定人是否包含 `x1` 或者 `x2`,满足一个指定人即可校验通过,同时校验标题是否满足条件,[校验规则](/guide/ref#-includes-校验规则)。
```yml
name: Check Issue
on:
issues:
types: [edited]
jobs:
check-issue:
runs-on: ubuntu-latest
steps:
- name: check-issue
uses: actions-cool/issues-helper@v1
with:
actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignee-includes: 'x1,x2'
title-includes: 'x1,x2/y1,y2'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1.2 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1.2 |
| issue-number | 指定的 issue | number | ✔ | v1.2 |
| assignee-includes | 是否包含指定人 | string | ✖ | v1.2 |
| title-includes | 标题包含校验 | string | ✖ | v1.2 |
| body-includes | 内容包含校验 | string | ✖ | v1.2 |
- `title-includes` `body-includes` 支持格式 `x1,x2` 或者 `x1,x2/y1,y2`。只支持两个层级
- 返回 `check-result`
## `close-issues`
每 7 天 UTC 0 时,关闭已填加 `need info` label 且 7 天以上未活跃的 issues。
```yml
name: Check need info
on:
schedule:
- cron: "0 0 */7 * *"
jobs:
check-need-info:
runs-on: ubuntu-latest
steps:
- name: close-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'need info'
inactive-day: 7
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有
## `find-comments`
查找当前仓库 1 号 issue 中,创建者是 k ,内容包含 `this` 的评论列表。
```yml
- name: Find comments
uses: actions-cool/issues-helper@v1
with:
actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: 1
comment-auth: 'k'
body-includes: 'this'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| comment-auth | 评论创建者,不填时会查询所有 | string | ✖ | v1 |
| body-includes | 评论内容包含过滤,不填时无校验 | string | ✖ | v1 |
| direction | 返回 `comments` 排序 | string | ✖ | v1 |
- 返回 `comments`,格式如下:
```js
[
{id: 1, auth: 'x', body: 'xxx', created: '', updated: ''},
{id: 2, auth: 'x', body: 'xxx', created: '', updated: ''},
]
```
- `direction` 默认为升序,只有设置 `desc` 时,会返回降序
- 返回数组中 `created` `updated`,由所处环境决定,会是 UTC +0
## `lock-issues`
每 3 个月 1 号 UTC 0 时,锁定已填加 `inactive` label 且 128 天以上未活跃的所有 issues。
```yml
name: Lock inactive issues
on:
schedule:
- cron: "0 0 1 */3 *"
jobs:
lock-issues:
runs-on: ubuntu-latest
steps:
- name: lock-issues
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }}
labels: 'inactive'
inactive-day: 128
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| body | 操作 issue 时,可进行评论。不填时,不评论 | string | ✖ | v1 |
| labels | 标签筛选 | string | ✖ | v1.1 |
| issue-state | 状态筛选 | string | ✖ | v1 |
| issue-assignee | 指定人筛选 | string | ✖ | v1 |
| issue-creator | 创建人筛选 | string | ✖ | v1 |
| issue-mentioned | 提及人筛选 | string | ✖ | v1 |
| body-includes | 包含内容筛选 | string | ✖ | v1 |
| title-includes | 包含标题筛选 | string | ✖ | v1 |
| inactive-day | 非活跃天数筛选 | number | ✖ | v1.2 |
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
- `issue-assignee`:不支持多人。不填或输入 * 时,查询所有。输入 `none` 会查询未添加指定人的 issues
- `inactive-day`:当输入时,会筛选 issue 更新时间早于当前时间减去非活跃天数。不填时,会查询所有

446
docs/base.en-US.md Normal file
View File

@@ -0,0 +1,446 @@
---
toc: menu
---
# ⭐ Base
In order to better display the function, the following is an example of the actual scene, please refer to it flexibly.
## `add-assignees`
When an issue is added or modified, assign this issue to one or more people.
```yml
name: Add Assigness
on:
issues:
types: [opened, edited]
jobs:
add-assigness:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| assignees | Designated person. No operation when no input or empty character | string | ✖ | v1.1 |
- `actions` support multiple and separated by comma. Like: `add-assignees,add-labels`
- The `name` can be modified according to the actual situation
- [Reference to on](/en-US/guide/ref#-github-docs)
- `${{ github.event.issue.number }}` is the current issue. [More references](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
- `assignees` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
## `add-labels`
When the content of a new issue does not contain the specified format, add labels for the issue.
```yml
name: Add Labels
on:
issues:
types: [opened]
jobs:
add-labels:
runs-on: ubuntu-latest
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug' or 'xx1,xx2'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| labels | New labels. When it is not filled in or is empty character, do not add | string | ✖ | v1.1 |
- `labels` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
## `close-issue`
Close the specified issue.
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
body: 'This is auto closed.'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
## `create-comment`
When a designated label is added, comment on the issue.
```yml
name: Create Comment
on:
issues:
types: [labeled]
jobs:
create-comment:
runs-on: ubuntu-latest
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Add some comments.
你好 @${{ github.event.issue.user.login }}。巴拉巴拉。
contents: '+1' or '+1,heart'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| body | Add comment content | string | ✖ | v1 |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
- `body` default is `Currently at ${owner}/${repo}. And this is default comment.`
- Where `${owner}/${repo}` means the current repo
- Return `comment-id`, which can be used for subsequent operations. [Usage reference](/en-US/guide/ref#-outputs-use)
- `${{ github.event.issue.user.login }}` indicates the creator of the issue
- `contents` support multiple and separated by comma. Pay attention to multiple settings, you need to use the version above v1.1
## `create-issue`
Here is an example, add an issue at UTC 00:00 on the 1st of every month.
```yml
name: Create Issue
on:
schedule:
- cron: "0 0 1 * *"
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: 'xxxx'
body: 'xxxx'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| title | The title of the new issue | string | ✖ | v1 |
| body | The body of the new issue | string | ✖ | v1 |
| labels | The labels for the new issue | string | ✖ | v1.1 |
| assignees | The assignees for the new issue | string | ✖ | v1.1 |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
- `title` default is `Default Title`
- Return `issue-number`. [Usage reference](/en-US/guide/ref#-outputs-use)
## `delete-comment`
According to [`comment-id`](/en-US/guide/ref#-comment-id) delete the specified comment.
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| comment-id | The comment ID | number | ✔ | v1 |
## `lock-issue`
When the `invalid` label is added, the issue is locked.
```yml
name: Lock Issue
on:
issues:
types: [labeled]
jobs:
lock-issue:
runs-on: ubuntu-latest
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
## `open-issue`
Open the specified issue.
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
## `remove-assignees`
Remove the person designated by issue.
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xx'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| assignees | Designated person removed. When it is an empty character, do not remove | string | ✔ | v1.1 |
## `remove-labels`
Remove the specified labels.
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.2
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1.2 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1.2 |
| issue-number | The number of issue | number | ✔ | v1.2 |
| labels | The removed labels. When it is a blank character, do not remove | string | ✔ | v1.2 |
- `labels` supports multiple, such as `x1,x2,x3`, only the labels added by the issue will be removed
## `set-labels`
Replace the labels of issue.
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| labels | labels set. When empty characters, will remove all | string | ✔ | v1.1 |
## `unlock-issue`
Unlock the specified issue.
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
## `update-comment`
Update the specified comment according to [`comment-id`](/en-US/guide/ref#-comment-id).
The following example shows that 👀 is added for each new comment.
```yml
name: Add eyes to each comment
on:
issue_comment:
types: [created]
jobs:
update-comment:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
contents: 'eyes'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| comment-id | The comment ID | number | ✔ | v1 |
| body | Update the content of comment | string | ✖ | v1 |
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
- When `body` is not entered, it will remain as it is
- When `update-mode` is `append`, additional operations will be performed. Anything other than `append` will be replaced. Only effective for `body`
## `update-issue`
Update the specified issue according to the `issue-number`.
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
state: 'open'
title: 'xxx'
body: 'xxxx'
update-mode: 'replace'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1 |
| issue-number | The number of issue | number | ✔ | v1 |
| state | Modify the status of issue, optional value `open` `closed` | string | ✖ | v1 |
| title | Modify the title of the issue | string | ✖ | v1 |
| body | Modify the content of issue | string | ✖ | v1 |
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ | v1 |
| labels | Replace the labels of issue | string | ✖ | v1.1 |
| assignees | Replace the assignees of issue | string | ✖ | v1.1 |
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ | v1.1 |
- `state` defaults to `open`
- When the option is not filled, it will keep the original
## `welcome`
When an issue is created, the user who created the issue for the first time is welcome.
If the user is not creating for the first time, there is no operation.
```yml
name: Issue Welcome
on:
issues:
types: [opened]
jobs:
issue-welcome:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.3
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
body: hi @${{ github.event.issue.user.login }}, welcome!
labels: 'welcome1, welcome2'
assignees: 'xx1'
issue-contents: '+1, -1, eyes'
```
| Param | Desc | Type | Required | Version |
| -- | -- | -- | -- | -- |
| actions | Action type | string | ✔ | v1.3 |
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ | v1.3 |
| body | Comment on the welcome content, no comment if you leave it blank | string | ✖ | v1.3 |
| labels | Add labels to this issue | string | ✖ | v1.3 |
| assignees | Add assignees to this issue | string | ✖ | v1.3 |
| issue-contents | Add [reaction](/en-US/guide/ref#-reactions-type) to this issue| string | ✖ | v1.3 |
- If these 4 options are not filled, no operation

445
docs/base.md Normal file
View File

@@ -0,0 +1,445 @@
---
toc: menu
---
为了更好的展示功能,下面以实际场景举例,请灵活参考。
# ⭐ 基 础
## `add-assignees`
当一个 issue 新增或修改时,将这个 issue 指定某人或多人。
```yml
name: Add Assigness
on:
issues:
types: [opened, edited]
jobs:
add-assigness:
runs-on: ubuntu-latest
steps:
- name: Add assigness
uses: actions-cool/issues-helper@v1
with:
actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xxx' or 'xx1,xx2'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| assignees | 指定人。当不填或者为空字符时,不操作 | string | ✖ | v1.1 |
- `actions` 支持多个,需用逗号隔开。如:`add-assignees,add-labels`
- 其中的 `name` 可根据自行根据实际情况修改
- [on 参考](/guide/ref#-github-相关文档)
- `${{ github.event.issue.number }}` 表示当前 issue[更多参考](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events)
- `assignees` 支持多个需用逗号隔开。注意设置多个需使用v1.1以上版本
## `add-labels`
当一个新增的 issue 内容不包含指定格式时,为这个 issue 添加 labels。
```yml
name: Add Labels
on:
issues:
types: [opened]
jobs:
add-labels:
runs-on: ubuntu-latest
if: contains(github.event.issue.body, 'xxx') == false
steps:
- name: Add labels
uses: actions-cool/issues-helper@v1
with:
actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'bug' or 'bug1,bug2'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| labels | 新增的 labels。当不填或者为空字符时不新增 | string | ✖ | v1.1 |
- `labels` 支持多个需用逗号隔开。注意设置多个需使用v1.1以上版本
## `close-issue`
关闭指定 issue。
```yml
- name: Close issue
uses: actions-cool/issues-helper@v1
with:
actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
body: 'This is auto closed.'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
## `create-comment`
当新增一个指定 label 时,对该 issue 进行评论。
```yml
name: Create Comment
on:
issues:
types: [labeled]
jobs:
create-comment:
runs-on: ubuntu-latest
if: github.event.label.name == 'xxx'
steps:
- name: Create comment
uses: actions-cool/issues-helper@v1
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello ${{ github.event.issue.user.login }}. Add some comments.
你好 ${{ github.event.issue.user.login }}。巴拉巴拉。
contents: '+1' or '+1,heart'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| body | 新增评论的内容 | string | ✖ | v1 |
| contents | 为新增评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
- `body` 默认为:`Currently at ${owner}/${repo}. And this is default comment.`
- 其中 `${owner}/${repo}` 表示当前仓库
- 返回 `comment-id`,可用于之后操作。[用法参考](/guide/ref#-outputs-使用)
- `${{ github.event.issue.user.login }}` 表示该 issue 的创建者
- `contents` 支持多个需用逗号隔开。注意设置多个需使用v1.1以上版本
## `create-issue`
感觉新增 issue 使用场景不多。这里举例,每月 1 号 UTC 00:00 新增一个 issue。
```yml
name: Create Issue
on:
schedule:
- cron: "0 0 1 * *"
jobs:
create-issue:
runs-on: ubuntu-latest
steps:
- name: Create issue
uses: actions-cool/issues-helper@v1
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
title: 'xxxx'
body: 'xxxx'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| title | 新增 issue 的标题 | string | ✖ | v1 |
| body | 新增 issue 的内容 | string | ✖ | v1 |
| labels | 为新增 issue 添加 labels | string | ✖ | v1.1 |
| assignees | 为新增 issue 添加 assignees | string | ✖ | v1.1 |
| contents | 为新增 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
- `title` 默认为:`Default Title`
- 返回 `issue-number`[用法参考](/guide/ref#-outputs-使用)
## `delete-comment`
根据 [`comment-id`](/guide/ref#-comment-id) 删除指定评论。
```yml
- name: Delete comment
uses: actions-cool/issues-helper@v1
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: xxx
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| comment-id | 指定的 comment | number | ✔ | v1 |
## `lock-issue`
当新增 `invalid` label 时,对该 issue 进行锁定。
```yml
name: Lock Issue
on:
issues:
types: [labeled]
jobs:
lock-issue:
runs-on: ubuntu-latest
if: github.event.label.name == 'invalid'
steps:
- name: Lock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
## `open-issue`
打开指定 issue。
```yml
- name: Open issue
uses: actions-cool/issues-helper@v1
with:
actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: xxx
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
## `remove-assignees`
移除 issue 指定人员。
```yml
- name: Remove assignees
uses: actions-cool/issues-helper@v1
with:
actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
assignees: 'xx'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| assignees | 移除的指定人。当为空字符时,不进行移除 | string | ✔ | v1.1 |
## `remove-labels`
移除指定 labels。
```yml
- name: Remove labels
uses: actions-cool/issues-helper@v1.2
with:
actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1.2 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1.2 |
| issue-number | 指定的 issue | number | ✔ | v1.2 |
| labels | 移除的 labels。当为空字符时不进行移除 | string | ✔ | v1.2 |
- `labels` 支持多个,如 `x1,x2,x3`,只会移除 issue 已添加的 labels
## `set-labels`
替换 issue 的 labels。
```yml
- name: Set labels
uses: actions-cool/issues-helper@v1
with:
actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: 'xx'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| labels | labels 设置。当空字符时,会移除所有 | string | ✔ | v1.1 |
## `unlock-issue`
解锁指定 issue。
```yml
- name: Unlock issue
uses: actions-cool/issues-helper@v1
with:
actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
## `update-comment`
根据 [`comment-id`](/guide/ref#-comment-id) 更新指定评论。
下面的例子展示的是,为每个新增的 comment 增加 👀 。
```yml
name: Add eyes to each comment
on:
issue_comment:
types: [created]
jobs:
update-comment:
runs-on: ubuntu-latest
steps:
- name: Update comment
uses: actions-cool/issues-helper@v1
with:
actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }}
comment-id: ${{ github.event.comment.id }}
contents: 'eyes'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| comment-id | 指定的 comment | number | ✔ | v1 |
| body | 更新 comment 的内容 | string | ✖ | v1 |
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
| contents | 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
- `body` 不填时,会保持原有
- `update-mode``append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
## `update-issue`
根据 `issue-number` 更新指定 issue。
```yml
- name: Update issue
uses: actions-cool/issues-helper@v1
with:
actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
state: 'open'
title: 'xxx'
body: 'xxxx'
update-mode: 'replace'
labels: 'xx'
assignees: 'xxx'
contents: '+1'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1 |
| issue-number | 指定的 issue | number | ✔ | v1 |
| state | 修改 issue 的状态,可选值 `open` `closed` | string | ✖ | v1 |
| title | 修改 issue 的标题 | string | ✖ | v1 |
| body | 修改 issue 的内容 | string | ✖ | v1 |
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ | v1 |
| labels | 替换 issue 的 labels | string | ✖ | v1.1 |
| assignees | 替换 issue 的 assignees | string | ✖ | v1.1 |
| contents | 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.1 |
- `state` 默认为 `open`
- 当可选项不填时,会保持原有
## `welcome`
当一个 issue 新建时,对首次新建 issue 的用户进行欢迎。若用户非首次新建,则无操作。
```yml
name: Issue Welcome
on:
issues:
types: [opened]
jobs:
issue-welcome:
runs-on: ubuntu-latest
steps:
- name: welcome
uses: actions-cool/issues-helper@v1.3
with:
actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }}
body: hi @${{ github.event.issue.user.login }}, welcome!
labels: 'welcome1, welcome2'
assignees: 'xx1'
issue-contents: '+1, -1, eyes'
```
| 参数 | 描述 | 类型 | 必填 | 版本 |
| -- | -- | -- | -- | -- |
| actions | 操作类型 | string | ✔ | v1.3 |
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ | v1.3 |
| body | 评论欢迎的内容,不填则不评论 | string | ✖ | v1.3 |
| labels | 为该 issue 增加 labels | string | ✖ | v1.3 |
| assignees | 为该 issue 增加 assignees | string | ✖ | v1.3 |
| issue-contents | 为该 issue 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ | v1.3 |
- 若这 4 个可选项都不填,则无操作

24
docs/changelog.en-US.md Normal file
View File

@@ -0,0 +1,24 @@
---
toc: menu
---
# ✨ Changelog
- Version rules
- Use two-level semantic version, such as v1, v1.1, v2, v2.1
- v1 represents the initial 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
- It is recommended to use the largest version and above for the parameters in the API
- 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)
- You can also refer to the update log below to select the version
- It also supports the direct use of branch versions. Such as:
```yml
- name: Issues Helper
uses: actions-cool/issues-helper@main
```
<embed src="./log.md"></embed>

24
docs/changelog.md Normal file
View File

@@ -0,0 +1,24 @@
---
toc: menu
---
# ✨ 更新日志
- 版本规则
- 采用两级语义化版本如v1、v1.1、v2、v2.1
- v1 表示初始版本
- 对 v1 版本的修复和新增会发布到 v1.1 版本
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
- API 中参数建议使用其中最大及以上版本
- 版本选择
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
- 同时也可参照下面的更新日志来选择版本
- 也支持直接使用分支版本。如:
```yml
- name: Issues Helper
uses: actions-cool/issues-helper@main
```
<embed src="./log.md"></embed>

27
docs/guide/faq.en-US.md Normal file
View File

@@ -0,0 +1,27 @@
---
toc: menu
---
## Is there a charge for this feature?
GitHub Actions is provided free of charge by GitHub. Among them, the `Private` project has a monthly limit of 2000 times, [see details](https://github.com/settings/billing). The `Public` project is unlimited.
## Are there any ready-made templates for reference?
Yes.
1. You can use this [GitHub Actions workflow template](https://github.com/actions-cool/.github) repository template
2. Personal exercises and tests [Actions](https://github.com/xrkffgg/test-ci) repository
3. You can also refer to the warehouse of [online users](/en-US#-who-is-using)
## I want to pause Actions, is there an easy way?
Yes, you can directly modify `actions`. For example: `actions:'create-comment'` is changed to `actions:'#create-comment'`. It is also convenient for recovery.
## So many versions, how to choose?
You can view the detailed [changelog](/en-US/changelog). The latest releases version is recommended.
## What should I do if there is no function I want here?
You can submit it in [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18).

27
docs/guide/faq.md Normal file
View File

@@ -0,0 +1,27 @@
---
toc: menu
---
## 该功能是否收费?
GitHub Actions 是由 GitHub 免费提供的。其中 `Private` 项目每月有 2000 次的限制,[具体查看](https://github.com/settings/billing)。`Public` 项目无限制。
## 有没有现成的模板可以参考?
有的。
1. 你可以使用这个 [GitHub Actions workflow template](https://github.com/actions-cool/.github) 仓库的模板
2. 个人练习和测试 [Actions](https://github.com/xrkffgg/test-ci) 的仓库
3. 也可以来 [线上使用者](/#-谁在使用?) 的仓库参照
## 我想暂停 Actions有没有简单的办法
有的,你可以将直接修改 `actions`。例如:`actions: 'create-comment'` 修改为 `actions: '#create-comment'`。同时也方便恢复。
## 这么多版本,如何选择?
你可以查看详细的 [更新日志](/changelog)。推荐采用最新 releases 版本。
## 如果这里没有我想要的功能,该怎么办?
你可以在 [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18) 中提出。

23
docs/guide/index.en-US.md Normal file
View File

@@ -0,0 +1,23 @@
## Introduction
The Issues Helper is a GitHub Action that easily helps you automatically manage issues.
### What are GitHub Actions?
Automate, customize, and execute your software development workflows right in your repository with GitHub Actions. You can discover, create, and share actions to perform any job you'd like, including CI/CD, and combine actions in a completely customized workflow. [More](https://docs.github.com/en/free-pro-team@latest/actions).
`issues-helper` is based on this, using GitHub Actions to help you deal with various operations on issues.
### ✨ Feature
- 😎 Complete free
- 🚀 Fully automatic
- 🏖 Hosted on the GitHub server, as long as GitHub is not down, it is not affected
### ⚡ Feedback
You are very welcome to try it out and put forward your comments. You can use the following methods:
- 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)
- Submit [Pull Request](https://github.com/actions-cool/issues-helper/pulls) to improve the code of `issues-helper`

23
docs/guide/index.md Normal file
View File

@@ -0,0 +1,23 @@
## 介 绍
Issues 助手是一个轻松帮你自动管理 issues 的 GitHub Action。
### GitHub Actions 是什么?
GitHub Actions 是由 GitHub 官方提供在存储库中自动化、自定义和执行软件开发工作流程。您可以发现创建和共享操作以执行所需的任何工作包括CI / CD并在完全定制的工作流程中组合操作。[更多介绍](https://docs.github.com/en/free-pro-team@latest/actions)。
`issues-helper` 就是以此为基础,利用 GitHub Actions 来帮你处理各种关于 issue 方面的操作。
### ✨ 特性
- 😎 完全免费
- 🚀 全自动操作
- 🏖 托管于 GitHub 服务器,只要 GitHub 不宕机,它就不受影响
### ⚡ 反馈
非常欢迎你来尝试使用,并提出意见,你可以通过以下方式:
- 通过 [Issue](https://github.com/actions-cool/issues-helper/issues) 报告 bug 或进行咨询
- 通过 [Discussions](https://github.com/actions-cool/issues-helper/discussions) 进行讨论
- 提交 [Pull Request](https://github.com/actions-cool/issues-helper/pulls) 改进 `issues-helper` 的代码

83
docs/guide/ref.en-US.md Normal file
View File

@@ -0,0 +1,83 @@
---
toc: menu
---
## 📍 `token`
Need to have the person token with push permission.
- [Personal token application](https://github.com/settings/tokens)
- Need to check `Full control of private repositories`
- Project add secrets
- Select settings, select secrets, select `New repository secret`
- `Name` is the same as in actions
- `Value` fill in the token just applied by the individual
When the token is not filled in actions or the corresponding secrets are not added to the project, it will default to `github-actions-bot`. [More](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow).
## 📍 GitHub Docs
- [Workflow syntax for GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
## 📍 `outputs` use
```yml
- name: Create issue
uses: actions-cool/issues-helper@v1
id: createissue
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check outputs
run: echo "Outputs issue_number is ${{ steps.createissue.outputs.issue-number }}"
```
[More](https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs).
## 📍 `includes` check rules
```js
"title-includes": 'x1,x2'
x1
x2
"x1y3y2" true
"y2 x1" true
"x2" true
"x3" false
```
```js
"title-includes": 'x1,x2/y1,y2'
x1 + y1
x2 + y1
x1 + y2
x2 + y2
"x1y3y2" true
"y2 x1" true
"1x2y" false
"x1" false
```
## 📍 `Reactions` Type
| content | emoji |
| -- | -- |
| `+1` | 👍 |
| `-1` | 👎 |
| `laugh` | 😄 |
| `confused` | 😕 |
| `heart` | ❤️ |
| `hooray` | 🎉 |
| `rocket` | 🚀 |
| `eyes` | 👀 |
For details, please [view](https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions).
## 📍 `comment-id`
Click the `···` icon in the upper right corner of a comment, select `Copy link`, and the number at the end of the url is `comment_id`.

83
docs/guide/ref.md Normal file
View File

@@ -0,0 +1,83 @@
---
toc: menu
---
## 📍 `token` 说明
需拥有 push 权限的人员 token。
- [个人 token 申请](https://github.com/settings/tokens)
- 需勾选 `Full control of private repositories`
- 项目添加 secrets
- 选择 settings选择 secrets选择 `New repository secret`
- `Name` 与 actions 中保持一致
- `Value` 填写刚才个人申请的 token
当 actions 不填写 token 时,或项目未添加对应 secrets 时,会默认为 `github-actions-bot`。[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow)。
## 📍 GitHub 相关文档
- [GitHub Actions 语法](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
## 📍 `outputs` 使用
```yml
- name: Create issue
uses: actions-cool/issues-helper@v1
id: createissue
with:
actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check outputs
run: echo "Outputs issue_number is ${{ steps.createissue.outputs.issue-number }}"
```
[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs)。
## 📍 `includes` 校验规则
```js
"title-includes": 'x1,x2'
x1
x2
"x1y3y2" true
"y2 x1" true
"x2" true
"x3" false
```
```js
"title-includes": 'x1,x2/y1,y2'
x1 + y1
x2 + y1
x1 + y2
x2 + y2
"x1y3y2" true
"y2 x1" true
"1x2y" false
"x1" false
```
## 📍 `Reactions` 类型
| content | emoji |
| -- | -- |
| `+1` | 👍 |
| `-1` | 👎 |
| `laugh` | 😄 |
| `confused` | 😕 |
| `heart` | ❤️ |
| `hooray` | 🎉 |
| `rocket` | 🚀 |
| `eyes` | 👀 |
如需详细了解,可 [查看](https://docs.github.com/en/free-pro-team@latest/rest/reference/reactions)。
## 📍 `comment-id`
点击某个评论右上角 `···` 图标,选择 `Copy link`url 末尾数字即是 `comment_id`

67
docs/guide/start.en-US.md Normal file
View File

@@ -0,0 +1,67 @@
## Quick start
### 1. New Action
Click Actions in the warehouse, if Actions have been added, the following interface will be displayed.
![](../../public/add-1.jpg)
Click `New workflow` to add.
![](../../public/add-2.jpg)
<Alert type="success">
You can click <Badge>set up a workflow yourself</Badge> to add a custom action, or you can apply a new action based on a template. <a target="_blank" href="https://github.com/actions-cool/.github">Templates</a>.
</Alert>
### 2. Edit Action
Actions storage address is fixed, unified as `/.github/workflows/xx.yml`.
Let's take the example of the home page and explain it in detail. The corresponding scenario is: when an issue adds the `help wanted` tag, the system will automatically comment.
```yml
name: Issue Reply
on:
issues:
types: [labeled]
jobs:
reply-helper:
runs-on: ubuntu-latest
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome PR。
你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈欢迎PR。
```
- `YML` syntax reference
- [Workflow syntax for GitHub Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- `name`: The workflow name
- Actions workflow name, can be customized according to actual situation
- `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)
- `uses`: Use actions name
- `uses: actions-cool/issues-helper@v1.2`。Please [refer](/en-US/changelog) to version selection
- `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
- `token`: A person who needs to have push permission token
- [More view](/en-US/guide/ref#-token)
- `issue-number`: Incoming parameter, here means the number of the current issue. If you are confused about the writing, you can [view](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context)
- `body`: Incoming parameters, here means the content of the current comment
### 3. Enable Action
When you finish writing and submit to the master branch, you can automatically enable the workflow, and the trigger conditions follow the definition of `on`.
😏 I believe that you have a general understanding of `how to use`, do you want to try it quickly?
Please check the functions you need in [Basic](/en-US/base) and [Advanced](/en-US/advanced) for flexible reference.

67
docs/guide/start.md Normal file
View File

@@ -0,0 +1,67 @@
## 快速开始
### 1. 新建 Action
点击仓库的 Actions若已增加过 Actions会显示如下界面。
![](../../public/add-1.jpg)
点击 `New workflow` 新增。
![](../../public/add-2.jpg)
<Alert type="success">
你可以点击 <Badge>set up a workflow yourself</Badge> 新增一个自定义 action也可以根据模板来套用新增一个 action。<a target="_blank" href="https://github.com/actions-cool/.github">模板使用</a>
</Alert>
### 2. 编写 Action
Actions 存放地址是固定的,统一为 `/.github/workflows/xx.yml`
下面拿首页的例子详细说明下。对应场景为:当一个 issue 新增 `help wanted` 标签时,系统会自动进行评论。
```yml
name: Issue Reply
on:
issues:
types: [labeled]
jobs:
reply-helper:
runs-on: ubuntu-latest
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome PR。
你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈欢迎PR。
```
- `YML` 语法参考
- [GitHub Actions 语法](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#on)
- `name`workflow 名称
- Actions 流程名称,可根据实际情况自定义
- `on`action 触发条件
- 参考 [工作流触发机制](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
- `uses`:使用 actions 名称
- `uses: actions-cool/issues-helper@v1.2`。版本选择请 [参考](/changelog)
- `issues-hepler` 参数
- `actions`:使用功能的名称,**必填**。支持多个,需用逗号隔开,如 `create-comment,close-issue` 表示评论和关闭 issue
- `token`:需拥有 push 权限的人员 token
- 更多 [参考](/guide/ref#-token-说明)
- `issue-number`:传入参数,这里表示当前 issue 的编号。如果你对写法疑惑,可 [查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context)
- `body`:传入参数,这里表示当前进行评论的内容
### 3. 启用 Action
当你完成编写完成提交到主分支后,即可自动启用该 workflow触发条件遵循 `on` 的定义。
😏 相信到这里你已经对 `如何使用` 有了大概的了解,是不是想快点尝试一下。
下面请在 [基 础](/base) 和 [进 阶](/advanced) 查看你需要的功能,灵活参考。

62
docs/index.en-US.md Normal file
View File

@@ -0,0 +1,62 @@
---
title: Issues Helper
order: 1
hero:
title: Issues Helper
image: https://avatars1.githubusercontent.com/u/73879334?s=200&v=4
desc: 🤖 A GitHub Action that easily helps you automatically manage issues
actions:
- text: Quick start
link: /en-US/guide/start
features:
- icon: https://github.com/actions-cool/resources/blob/main/image/free.png?raw=true
title: Completely free
desc: Use the Actions service provided by GitHub
- icon: https://github.com/actions-cool/resources/blob/main/image/snap.png?raw=true
title: Easy to use
desc: Detailed tutorials and rich templates
- icon: https://github.com/actions-cool/resources/blob/main/image/network.png?raw=true
title: Easy hosting
desc: As long as GitHub is not down, it will not be affected
footer: Open-source MIT Licensed | Copyright © 2020-present<br />Powered by xrkffgg
---
## 🍭 Get started quickly
Here is a very simple and commonly used example. The corresponding scenario is: when an issue adds the `help wanted` tag, the system will automatically comment.
```yml
name: Issue Reply
on:
issues:
types: [labeled]
jobs:
reply-helper:
runs-on: ubuntu-latest
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome PR。
你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈欢迎PR。
```
## 💖 Who is using?
<code src="./users.tsx" inline />
## ⚡ Feedback
You are very welcome to try it out and put forward your comments. You can use the following methods:
- 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)
- Submit [Pull Request](https://github.com/actions-cool/issues-helper/pulls) to improve the code of `issues-helper`

62
docs/index.md Normal file
View File

@@ -0,0 +1,62 @@
---
title: Issues 助手
order: 1
hero:
title: Issues 助手
image: https://avatars1.githubusercontent.com/u/73879334?s=200&v=4
desc: 🤖 一个轻松帮你自动管理 issues 的 GitHub Action
actions:
- text: 快速开始
link: /guide/start
features:
- icon: https://github.com/actions-cool/resources/blob/main/image/free.png?raw=true
title: 完全免费
desc: 使用 GitHub 自带提供的 Actions 服务
- icon: https://github.com/actions-cool/resources/blob/main/image/snap.png?raw=true
title: 简单易用
desc: 教程详细,模版丰富
- icon: https://github.com/actions-cool/resources/blob/main/image/network.png?raw=true
title: 轻松托管
desc: 只要 GitHub 不宕机,它就不受影响
footer: Open-source MIT Licensed | Copyright © 2020-present<br />Powered by xrkffgg
---
## 🍭 快速上手
这里列举一个非常简单以及常用的例子。对应场景为:当一个 issue 新增 `help wanted` 标签时,系统会自动进行评论。
```yml
name: Issue Reply
on:
issues:
types: [labeled]
jobs:
reply-helper:
runs-on: ubuntu-latest
steps:
- name: help wanted
if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v1.2
with:
actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. We totally like your proposal/feedback, welcome PR。
你好 @${{ github.event.issue.user.login }},我们完全同意你的提议/反馈欢迎PR。
```
## 💖 谁在使用?
<code src="./users.tsx" inline />
## ⚡ 反馈
非常欢迎你来尝试使用,并提出意见,你可以通过以下方式:
- 通过 [Issue](https://github.com/actions-cool/issues-helper/issues) 报告 bug 或进行咨询
- 通过 [Discussions](https://github.com/actions-cool/issues-helper/discussions) 进行讨论
- 提交 [Pull Request](https://github.com/actions-cool/issues-helper/pulls) 改进 `issues-helper` 的代码

23
docs/log.md Normal file
View File

@@ -0,0 +1,23 @@
## v1.3
`2020.12.28`
- feat: add welcome. [#19](https://github.com/actions-cool/issues-helper/pull/19)
## v1.2
`2020.12.25`
- feat: add check-issue & remove labels. [#12](https://github.com/actions-cool/issues-helper/pull/12)
## v1.1
`2020.12.24`
- fix: yml not support array. [#11](https://github.com/actions-cool/issues-helper/pull/11)
## v1
`2020.12.23`
🎉 First release.

71
docs/users.tsx Normal file
View File

@@ -0,0 +1,71 @@
/* eslint-disable react/jsx-no-target-blank */
import React from 'react';
const USERS = [
{
name: 'ant-design',
link: 'https://github.com/ant-design/ant-design',
logo: 'https://avatars1.githubusercontent.com/u/12101536?s=200&v=4',
},
{
name: 'ant-design-vue',
link: 'https://github.com/vueComponent/ant-design-vue',
logo: 'https://avatars2.githubusercontent.com/u/32120805?s=200&v=4',
},
{
name: 'dumi',
link: 'https://github.com/umijs/dumi',
logo: 'https://avatars2.githubusercontent.com/u/33895495?s=200&v=4',
},
{
name: 'umi',
link: 'https://github.com/umijs/umi',
logo: 'https://avatars2.githubusercontent.com/u/33895495?s=200&v=4',
},
{
name: 'vue-request',
link: 'https://github.com/AttoJS/vue-request',
logo: 'https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png',
}
];
export default () => {
return (
<ul style={{ display: 'flex', flexWrap: 'wrap', margin: 0, padding: 0, listStyle: 'none' }}>
{USERS.map((user, i) => (
<li
key={user.link}
style={{
width: 220,
marginRight: i === USERS.length - 1 ? 0 : 16,
marginBottom: 8,
border: '1px solid #eee',
textAlign: 'center',
fontSize: 20,
fontWeight: 600,
borderRadius: 2,
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}
>
<a
style={{ display: 'block', color: '#666', padding: '18px', textDecoration: 'none' }}
target="_blank"
href={user.link}
>
<img
width={(user.name && 40) || undefined}
height={(!user.name && 40) || undefined}
style={{ verticalAlign: '-0.32em' }}
src={user.logo}
alt={user.name}
/>
<div style={{ marginTop: 10 }}>{user.name}</div>
</a>
</li>
))}
</ul>
);
};

View File

@@ -1,17 +1,23 @@
{
"name": "issue-helper",
"version": "1.0.0",
"version": "1.3.0",
"private": true,
"description": "Some operations on issue.",
"main": "src/main.js",
"scripts": {
"start": "dumi dev",
"docs:build": "dumi build",
"docs-dev:build": "UMI_ENV=dev dumi build",
"docs:deploy": "gh-pages -d docs-dist",
"deploy": "npm run docs:build && npm run docs:deploy",
"package": "ncc build src/main.js -o dist"
},
"author": "xrkffgg",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/actions-cool/issue-helper.git"
"url": "https://github.com/actions-cool/issue-helper.git",
"branch": "main"
},
"keywords": [
"actions",
@@ -27,6 +33,9 @@
},
"devDependencies": {
"@vercel/ncc": "^0.25.1",
"dotenv": "^8.2.0"
"dotenv": "^8.2.0",
"dumi": "^1.1.0-rc.8",
"gh-pages": "^3.1.0",
"react": "^17.0.1"
}
}

BIN
public/add-1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
public/add-2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -15,6 +15,8 @@ const {
doLockIssue
} = require('./base.js');
const { dealInput, matchKeyword } = require('./util.js');
const token = core.getInput('token');
const octokit = new Octokit({ auth: `token ${token}` });
@@ -24,6 +26,7 @@ direction = direction === 'desc' ? 'desc' : 'asc';
const commentAuth = core.getInput("comment-auth");
const bodyIncludes = core.getInput('body-includes');
const titleIncludes = core.getInput('title-includes');
const assigneeIncludes = core.getInput('assignee-includes');
const issueCreator = core.getInput("issue-creator");
const issueAssignee = core.getInput('issue-assignee');
@@ -57,6 +60,54 @@ async function doCheckInactive (owner, repo, labels) {
}
};
/**
* 检查 issue 是否满足条件,满足返回 true
* 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
* 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
*/
async function doCheckIssue (owner, repo, issueNumber) {
var checkResult = true;
const issue = await octokit.issues.get({
owner,
repo,
issue_number: issueNumber
});
if (!!checkResult && assigneeIncludes) {
let assigneesCheck = dealInput(assigneeIncludes);
let checkAssignee = false;
issue.data.assignees.forEach(it => {
if (checkResult && !checkAssignee && assigneesCheck.includes(it.login)) {
checkResult = true;
checkAssignee = true;
}
})
!checkAssignee ? checkResult = false : null;
}
if (!!checkResult && titleIncludes) {
const titleArr = titleIncludes.split('/');
const keyword1 = dealInput(titleArr[0]);
const keyword2 = dealInput(titleArr[1]);
checkResult =
keyword2.length ?
matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) :
matchKeyword(issue.data.title, keyword1);
}
if (!!checkResult && bodyIncludes) {
const bodyArr = bodyIncludes.split('/');
const keyword1 = dealInput(bodyArr[0]);
const keyword2 = dealInput(bodyArr[1]);
checkResult =
keyword2.length ?
matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) :
matchKeyword(issue.data.body, keyword1);
}
core.info(`Actions: [check-issue][${!!checkResult}] success!`);
core.setOutput("check-result", !!checkResult);
};
async function doCloseIssues (owner, repo, labels) {
const issues = await doQueryIssues(owner, repo, labels, 'open');
@@ -114,7 +165,7 @@ async function doLockIssues (owner, repo, labels) {
}
};
async function doQueryIssues (owner, repo, labels, state) {
async function doQueryIssues (owner, repo, labels, state, creator) {
let params = {
owner,
repo,
@@ -126,15 +177,11 @@ async function doQueryIssues (owner, repo, labels, state) {
issueMentioned ? params.mentioned = issueMentioned : null;
if (labels) {
if (typeof(labels) === 'string') {
params.labels = labels;
} else {
let temp = '';
labels.forEach((it,index) => {
index == labels.length - 1 ? temp += `${it}` : temp += `${it},`;
});
params.labels = temp;
}
params.labels = labels;
}
if (creator) {
params.creator = creator;
}
const res = await octokit.issues.listForRepo(params);
@@ -142,7 +189,12 @@ async function doQueryIssues (owner, repo, labels, state) {
res.data.forEach(iss => {
const a = bodyIncludes ? iss.body.includes(bodyIncludes) : true;
const b = titleIncludes ? iss.title.includes(titleIncludes) : true;
if (a && b) {
/**
* Note: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request.
* For this reason, "Issues" endpoints may return both issues and pull requests in the response.
* You can identify pull requests by the pull_request key.
*/
if (a && b && iss.pull_request === undefined) {
if (inactiveDay && typeof(inactiveDay) === 'number') {
let lastTime = dayjs.utc().subtract(inactiveDay, 'day');
let updateTime = dayjs.utc(iss.updated_at);
@@ -160,7 +212,11 @@ async function doQueryIssues (owner, repo, labels, state) {
module.exports = {
doCheckInactive,
doCheckIssue,
doCloseIssues,
doFindComments,
doLockIssues,
// tool
doQueryIssues,
};

View File

@@ -1,7 +1,10 @@
require('dotenv').config();
const core = require("@actions/core");
const github = require("@actions/github");
const { Octokit } = require('@octokit/rest');
const { doQueryIssues } = require('./advanced.js');
const ALLREACTIONS = [
"+1",
"-1",
@@ -19,6 +22,7 @@ const token = core.getInput('token');
const octokit = new Octokit({ auth: `token ${token}` });
const contents = core.getInput("contents");
const issueContents = core.getInput("issue-contents");
async function doAddAssignees (owner, repo, issueNumber, assignees) {
await octokit.issues.addAssignees({
@@ -61,12 +65,12 @@ async function doCreateComment (owner, repo, issueNumber, body) {
core.setOutput("comment-id", data.id);
if (contents) {
await doCreateCommentContent(owner, repo, data.id, contents);
await doCreateCommentContent(owner, repo, data.id, dealInput(contents));
}
};
async function doCreateCommentContent(owner, repo, commentId) {
if (typeof(contents) === 'object') {
async function doCreateCommentContent(owner, repo, commentId, contents) {
if (contents.length) {
contents.forEach(async item => {
if (testContent(item)) {
await octokit.reactions.createForIssueComment({
@@ -78,14 +82,6 @@ async function doCreateCommentContent(owner, repo, commentId) {
core.info(`Actions: [create-reactions][${item}] success!`);
}
})
} else if (typeof(contents) === 'string' && testContent(contents)) {
await octokit.reactions.createForIssueComment({
owner,
repo,
comment_id: commentId,
content: contents
});
core.info(`Actions: [create-reactions][${contents}] success!`);
}
};
@@ -104,12 +100,12 @@ async function doCreateIssue (owner, repo, title, body, labels, assignees) {
core.setOutput("issue-number", data.number);
if (contents) {
await doCreateIssueContent(owner, repo, data.number, contents);
await doCreateIssueContent(owner, repo, data.number, dealInput(contents));
}
};
async function doCreateIssueContent(owner, repo, issueNumber) {
if (typeof(contents) === 'object') {
async function doCreateIssueContent(owner, repo, issueNumber, contents) {
if (contents.length) {
contents.forEach(async item => {
if (testContent(item)) {
await octokit.reactions.createForIssue({
@@ -121,14 +117,6 @@ async function doCreateIssueContent(owner, repo, issueNumber) {
core.info(`Actions: [create-reactions][${item}] success!`);
}
})
} else if (typeof(contents) === 'string' && testContent(contents)) {
await octokit.reactions.createForIssue({
owner,
repo,
issue_number: issueNumber,
content: contents
});
core.info(`Actions: [create-reactions][${contents}] success!`);
}
};
@@ -170,6 +158,28 @@ async function doRemoveAssignees (owner, repo, issueNumber, assignees) {
core.info(`Actions: [remove-assignees][${assignees}] success!`);
};
async function doRemoveLabels (owner, repo, issueNumber, labels) {
const issue = await octokit.issues.get({
owner,
repo,
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,
repo,
issue_number: issueNumber,
labels: addLables
});
core.info(`Actions: [remove-labels][${labels}] success!`);
}
};
async function doSetLabels (owner, repo, issueNumber, labels) {
await octokit.issues.setLabels({
owner,
@@ -218,10 +228,10 @@ async function doUpdateComment (
await octokit.issues.updateComment(params);
core.info(`Actions: [update-comment][${commentId}] success!`);
}
}
if (contents) {
await doCreateCommentContent(owner, repo, commentId, contents);
await doCreateCommentContent(owner, repo, commentId, dealInput(contents));
}
};
@@ -243,8 +253,20 @@ async function doUpdateIssue (
})
const issue_body = issue.data.body;
const issue_title = issue.data.title;
const issue_labels = issue.data.labels;
const issue_assignees = issue.data.assignees;
let issue_labels = [];
if (issue.data.labels.length > 0) {
issue.data.labels.forEach(it =>{
issue_labels.push(it.name);
});
}
let issue_assignees = [];
if (issue.data.assignees.length > 0) {
issue.data.assignees.forEach(it =>{
issue_assignees.push(it.login);
});
}
let params = {
owner,
@@ -278,6 +300,41 @@ async function doUpdateIssue (
}
};
async function doWelcome (owner, repo, assignees, labels, body) {
const context = github.context;
const isIssue = !!context.payload.issue;
if (!isIssue) {
core.setFailed("The event that triggered this action must be a issue. Error!");
} else {
const auth = context.payload.sender.login;
core.info(`Actions: [welcome: auth=][${auth}]`);
const issueNumber = context.issue.number;
const creator = 'zoo-js-bot';
const issues = await doQueryIssues(owner, repo, false, 'all', creator);
if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) {
if (core.getInput("body")) {
await doCreateComment(owner, repo, issueNumber, body);
} else {
core.info(`Actions: [welcome] no body!`);
}
if (assignees) {
await doAddAssignees(owner, repo, issueNumber, assignees);
}
if (labels) {
await doAddLabels(owner, repo, issueNumber, labels);
}
if (issueContents) {
await doCreateIssueContent(owner, repo, issueNumber, dealInput(issueContents));
}
} else {
core.info(`Actions: [welcome][${auth}] is not first time!`);
}
}
};
// tool
function testContent(con) {
if (ALLREACTIONS.includes(con)) {
@@ -301,8 +358,10 @@ module.exports = {
doLockIssue,
doOpenIssue,
doRemoveAssignees,
doRemoveLabels,
doSetLabels,
doUnlockIssue,
doUpdateComment,
doUpdateIssue,
doWelcome,
};

View File

@@ -13,14 +13,17 @@ const {
doLockIssue,
doOpenIssue,
doRemoveAssignees,
doRemoveLabels,
doSetLabels,
doUnlockIssue,
doUpdateComment,
doUpdateIssue,
doWelcome,
} = require('./base.js');
const {
doCheckInactive,
doCheckIssue,
doCloseIssues,
doFindComments,
doLockIssues,
@@ -37,13 +40,16 @@ const ALLACTIONS = [
'lock-issue',
'open-issue',
'remove-assignees',
'remove-labels',
'set-labels',
'unlock-issue',
'update-comment',
'update-issue',
'welcome',
// advanced
'check-inactive',
'check-issue',
'close-issues',
'find-comments',
'lock-issues',
@@ -117,6 +123,9 @@ async function main() {
case 'remove-assignees':
await doRemoveAssignees(owner, repo, issueNumber, assignees);
break;
case 'remove-labels':
await doRemoveLabels(owner, repo, issueNumber, labels);
break;
case 'set-labels':
await doSetLabels(owner, repo, issueNumber, labels);
break;
@@ -145,6 +154,15 @@ async function main() {
labels
);
break;
case 'welcome':
await doWelcome(
owner,
repo,
assignees,
labels,
body
);
break;
// advanced
case 'check-inactive':
@@ -154,6 +172,13 @@ async function main() {
labels
)
break;
case 'check-issue':
await doCheckIssue(
owner,
repo,
issueNumber
);
break;
case 'close-issues':
await doCloseIssues(
owner,

View File

@@ -1,15 +1,21 @@
function dealInput (para) {
let arr = [];
if (para) {
if (typeof(para) === 'string') {
arr.push(para);
} else {
arr = para;
}
const paraArr = para.split(',');
paraArr.forEach(it => {
if(it.trim()){
arr.push(it.trim())
}
})
}
return arr;
};
function matchKeyword(content, keywords) {
return keywords.find(item => content.toLowerCase().includes(item));
};
module.exports = {
dealInput,
matchKeyword,
};

16
tsconfig.json Normal file
View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "esnext",
"moduleResolution": "node",
"baseUrl": "./",
"jsx": "preserve",
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
"@/*": ["src/*"],
"@@/*": ["src/.umi/*"],
"rc-dialog": ["src/index.ts"]
}
}
}