mirror of
https://gitea.com/Lydanne/issues-helper.git
synced 2025-08-19 18:25:58 +08:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
39ff3699d6 | ||
![]() |
efca7df548 | ||
![]() |
19c073d744 | ||
![]() |
a6a35924a4 | ||
![]() |
eb13c18a92 | ||
![]() |
d4e1fb07d0 | ||
![]() |
d2ccffe750 | ||
![]() |
f65aeadf97 | ||
![]() |
03f463ffc8 | ||
![]() |
728e5aa63e | ||
![]() |
2a7406da4f | ||
![]() |
f743eedacb | ||
![]() |
65461c17ed | ||
![]() |
1efbf3d3cf | ||
![]() |
14e4762bf5 | ||
![]() |
fd3eb6dbd3 | ||
![]() |
561193570f | ||
![]() |
f2288b2a14 | ||
![]() |
4281108d01 | ||
![]() |
1cc6f0b7ca | ||
![]() |
f6788d2b8e | ||
![]() |
8acd7991df | ||
![]() |
321da097ae | ||
![]() |
13e635fb2c | ||
![]() |
ae8b2ad0bd | ||
![]() |
576d7c4cb8 | ||
![]() |
b0e25793f1 | ||
![]() |
eb91801d3e | ||
![]() |
616c112b12 | ||
![]() |
1425c335af | ||
![]() |
f777971d6d | ||
![]() |
4c5e1fa83c | ||
![]() |
dcad795964 | ||
![]() |
37632245d8 | ||
![]() |
9018700e94 | ||
![]() |
11acd15e70 | ||
![]() |
7619e79b94 | ||
![]() |
c7cf5de709 | ||
![]() |
273b6abb78 |
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -11,9 +11,9 @@ jobs:
|
||||
|
||||
- name: install
|
||||
run: yarn install
|
||||
|
||||
- name: format
|
||||
run: yarn format-check
|
||||
|
||||
- name: package
|
||||
run: yarn package
|
||||
|
||||
- name: package
|
||||
run: yarn docs:build
|
||||
|
17
.github/workflows/gh-pages.yml
vendored
Normal file
17
.github/workflows/gh-pages.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: github pages
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: npm install
|
||||
- run: npm run docs:build
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs-dist
|
4
.github/workflows/surge-preview.yml
vendored
4
.github/workflows/surge-preview.yml
vendored
@@ -1,14 +1,12 @@
|
||||
name: 🔂 Surge PR Preview
|
||||
|
||||
on: pull_request_target
|
||||
on: pull_request
|
||||
|
||||
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 }}
|
||||
|
5
.prettierignore
Normal file
5
.prettierignore
Normal file
@@ -0,0 +1,5 @@
|
||||
dist/
|
||||
lib/
|
||||
docs-dist/
|
||||
node_modules/
|
||||
src/.umi/
|
6
.prettierrc.js
Normal file
6
.prettierrc.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const fabric = require('@umijs/fabric');
|
||||
|
||||
module.exports = {
|
||||
...fabric.prettier,
|
||||
arrowParens: 'avoid',
|
||||
};
|
@@ -1,4 +1,4 @@
|
||||
export default {
|
||||
base: '/',
|
||||
publicPath: '/'
|
||||
publicPath: '/',
|
||||
};
|
||||
|
@@ -6,10 +6,8 @@ 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',
|
||||
favicon: 'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4',
|
||||
logo: 'https://avatars1.githubusercontent.com/u/73879334?s=200&v=4',
|
||||
exportStatic: {},
|
||||
ssr: {},
|
||||
outputPath: 'docs-dist',
|
||||
@@ -38,7 +36,7 @@ export default defineConfig({
|
||||
{ title: 'Advanced', path: '/en-US/advanced' },
|
||||
{ title: 'Changelog', path: '/en-US/changelog' },
|
||||
{ title: 'GitHub', path: 'https://github.com/actions-cool/issues-helper' },
|
||||
]
|
||||
],
|
||||
},
|
||||
menus: {
|
||||
'/guide': [
|
||||
|
43
CHANGELOG.md
43
CHANGELOG.md
@@ -1,3 +1,46 @@
|
||||
# Changelog
|
||||
|
||||
## v2.1.2
|
||||
|
||||
`2021.02.19`
|
||||
|
||||
- feat: update/delete comment support find-comments out. [#63](https://github.com/actions-cool/issues-helper/pull/63)
|
||||
|
||||
## v2.1.1
|
||||
|
||||
`2021.02.03`
|
||||
|
||||
- fix: api request limit. [#57](https://github.com/actions-cool/issues-helper/pull/57)
|
||||
- chore: add catch. [#59](https://github.com/actions-cool/issues-helper/pull/59)
|
||||
|
||||
## v2.1.0
|
||||
|
||||
`2021.02.02`
|
||||
|
||||
- feat: add create-label. [#54](https://github.com/actions-cool/issues-helper/pull/54)
|
||||
|
||||
## v2.0.0
|
||||
|
||||
`2021.01.26`
|
||||
|
||||
- refactor: add require-permission default. [#51](https://github.com/actions-cool/issues-helper/pull/51)
|
||||
|
||||
## v1.12
|
||||
|
||||
> It will be the last version of 1.x
|
||||
|
||||
`2021.01.26`
|
||||
|
||||
- feat: add require-permission. [#46](https://github.com/actions-cool/issues-helper/pull/46) [#48](https://github.com/actions-cool/issues-helper/pull/48)
|
||||
- feat: add lock-reason. [#49](https://github.com/actions-cool/issues-helper/pull/49)
|
||||
|
||||
## v1.11
|
||||
|
||||
`2021.01.14`
|
||||
|
||||
- feat: add question mark duplicate. [#38](https://github.com/actions-cool/issues-helper/pull/38)
|
||||
- perf: expand duplicate action. [#40](https://github.com/actions-cool/issues-helper/pull/40)
|
||||
|
||||
## v1.10
|
||||
|
||||
`2021.01.12`
|
||||
|
191
README.en-US.md
191
README.en-US.md
@@ -5,9 +5,11 @@
|
||||
[](https://github.com/actions-cool/issues-helper/actions)
|
||||
[](https://github.com/marketplace/actions/issues-helper)
|
||||
[](https://github.com/umijs/dumi)
|
||||
[](https://github.com/prettier/prettier)
|
||||
|
||||
[](https://github.com/actions-cool/issues-helper/releases)
|
||||
[](https://github.com/actions-cool/issues-helper/discussions)
|
||||
[](https://github.com/actions-cool/issues-helper/stargazers)
|
||||
[](https://github.com/actions-cool/issues-helper/discussions)
|
||||
[](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
|
||||
|
||||
A GitHub Action that easily helps you automatically manage issues
|
||||
@@ -49,11 +51,32 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
|
||||
<div>dumi</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/vuejs/jsx-next">
|
||||
<img src="https://avatars.githubusercontent.com/u/6128107?s=200&v=4" width="46" />
|
||||
<div>jsx-next</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/mui-org/material-ui">
|
||||
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
|
||||
<div>material-ui</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/prettier/prettier">
|
||||
<img src="https://github.com/prettier/prettier-logo/blob/master/images/prettier-icon-light.png?raw=true" width="46" />
|
||||
<div>prettier</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/ant-design/pro-components">
|
||||
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
|
||||
<div>pro-components</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/react-component">
|
||||
<img src="https://avatars3.githubusercontent.com/u/9441414?s=200&v=4" width="46" />
|
||||
<div>react-component</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/lijinke666/react-music-player">
|
||||
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
|
||||
@@ -64,12 +87,17 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
|
||||
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
|
||||
<div>umi</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/vitejs/vite">
|
||||
<img src="https://avatars.githubusercontent.com/u/65625612?s=200&v=4" width="46" />
|
||||
<div>vite</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/AttoJS/vue-request">
|
||||
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
|
||||
<div>vue-request</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/zoo-js/zoo">
|
||||
<img src="https://avatars1.githubusercontent.com/u/70757173?s=200&v=4" width="46" />
|
||||
@@ -77,7 +105,6 @@ Please leave a message at [**here**](https://github.com/actions-cool/issues-help
|
||||
</a></td>
|
||||
<td align="center" width="180"></td>
|
||||
<td align="center" width="180"></td>
|
||||
<td align="center" width="180"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -91,6 +118,7 @@ When the following list does not have the features you want, you can submit it i
|
||||
- [`close-issue`](#close-issue)
|
||||
- [`create-comment`](#create-comment)
|
||||
- [`create-issue`](#create-issue)
|
||||
- [`create-label`](#create-label)
|
||||
- [`delete-comment`](#delete-comment)
|
||||
- [`lock-issue`](#lock-issue)
|
||||
- [`mark-duplicate`](#mark-duplicate)
|
||||
@@ -134,7 +162,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add assigness
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -176,7 +204,7 @@ jobs:
|
||||
if: contains(github.event.issue.body, 'xxx') == false
|
||||
steps:
|
||||
- name: Add labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -201,7 +229,7 @@ Close the specified issue.
|
||||
|
||||
```yml
|
||||
- name: Close issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -234,7 +262,7 @@ jobs:
|
||||
if: github.event.label.name == 'xxx'
|
||||
steps:
|
||||
- name: Create comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -278,7 +306,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -305,13 +333,41 @@ jobs:
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
#### `create-label`
|
||||
|
||||
Create label. If you want to maintain labels in batches, [see](https://github.com/actions-cool/labels-helper).
|
||||
|
||||
```yml
|
||||
- name: Create label
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-label'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
label-name: 'xx'
|
||||
label-color: '0095b3'
|
||||
label-desc: 'xx'
|
||||
```
|
||||
|
||||
| Param | Desc | Type | Required |
|
||||
| -- | -- | -- | -- |
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](#token) | string | ✔ |
|
||||
| label-name | Label name, emoji support | string | ✔ |
|
||||
| label-color | Label color, the format is hexadecimal color code, without `#` | string | ✖ |
|
||||
| label-desc | Label description | string | ✖ |
|
||||
|
||||
- `label-name`: If it already exists, no operation
|
||||
- `label-color`: Default is `ededed`
|
||||
|
||||
⏫ [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.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'delete-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -323,6 +379,9 @@ According to [`comment-id`](#comment-id) delete the specified comment.
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](#token) | string | ✔ |
|
||||
| comment-id | The comment ID | number | ✔ |
|
||||
| out-comments | The output of `find-comments`, if you find multiple, operate multiple | string | ✖ |
|
||||
|
||||
- When `out-comments` is entered, `comment-id` does not work
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
@@ -343,7 +402,7 @@ jobs:
|
||||
if: github.event.label.name == 'invalid'
|
||||
steps:
|
||||
- name: Lock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -355,26 +414,29 @@ jobs:
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](#token) | string | ✔ |
|
||||
| issue-number | The number of issue | number | ✔ |
|
||||
| lock-reason | Reason for locking issue | string | ✖ |
|
||||
|
||||
- `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam`
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
#### `mark-duplicate`
|
||||
|
||||
Quickly mark duplicate questions, only for issue new comments.
|
||||
Quickly mark duplicate questions, only for issue new comments or edit comments.
|
||||
|
||||
```yml
|
||||
name: Issue Mark Duplicate
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
mark-duplicate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: mark-duplicate
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'mark-duplicate'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -390,10 +452,16 @@ jobs:
|
||||
| labels | Replace the labels of the issue | string | ✖ |
|
||||
| contents | Add [reaction](#reactions-types) for this comment | string | ✖ |
|
||||
| close-issue | Whether to close the issue at the same time | string | ✖ |
|
||||
| require-permission | Permission required, default is `write` | string | ✖ |
|
||||
|
||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`
|
||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
||||
- `labels`: Highest priority
|
||||
- `close-issue`: Both `true` or `'true'` can take effect
|
||||
- `require-permission`: Optional values are `admin`, `write`, `read`, `none`
|
||||
- If the team member sets the `read` permission, it is `read`
|
||||
- If the external Collaborator is set to `read` permission, it is `read`
|
||||
- Ordinary users have `read` permission
|
||||
- When set `write`, `admin` and `write` meet the conditions
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
@@ -403,7 +471,7 @@ Open the specified issue.
|
||||
|
||||
```yml
|
||||
- name: Open issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'open-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -424,7 +492,7 @@ Remove the person designated by issue.
|
||||
|
||||
```yml
|
||||
- name: Remove assignees
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -447,7 +515,7 @@ Remove the specified labels.
|
||||
|
||||
```yml
|
||||
- name: Remove labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -472,7 +540,7 @@ Replace the labels of issue.
|
||||
|
||||
```yml
|
||||
- name: Set labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'set-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -495,7 +563,7 @@ Unlock the specified issue.
|
||||
|
||||
```yml
|
||||
- name: Unlock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'unlock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -528,7 +596,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -541,12 +609,14 @@ jobs:
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](#token) | string | ✔ |
|
||||
| comment-id | The comment ID | number | ✔ |
|
||||
| out-comments | The output of `find-comments`, if you find multiple, operate multiple | string | ✖ |
|
||||
| body | Update the content of comment | string | ✖ |
|
||||
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ |
|
||||
| contents | Add [reaction](#reactions-types) | string | ✖ |
|
||||
|
||||
- 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`
|
||||
- When `out-comments` is entered, `comment-id` does not work
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
@@ -556,7 +626,7 @@ Update the specified issue according to the `issue-number`.
|
||||
|
||||
```yml
|
||||
- name: Update issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -606,7 +676,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: welcome
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'welcome'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -649,7 +719,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-inactive
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-inactive'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -702,7 +772,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -741,7 +811,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: close-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -775,7 +845,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
|
||||
|
||||
```yml
|
||||
- name: Find comments
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'find-comments'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -823,7 +893,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: lock-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -845,6 +915,7 @@ jobs:
|
||||
| body-includes | Body filtering | string | ✖ |
|
||||
| title-includes | Title filtering | string | ✖ |
|
||||
| inactive-day | Inactive days filtering | number | ✖ |
|
||||
| lock-reason | Reason for locking issue | string | ✖ |
|
||||
|
||||
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
|
||||
- `issue-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
|
||||
@@ -869,7 +940,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: month-statistics
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'month-statistics'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -897,13 +968,15 @@ 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.
|
||||
Hypothetical scenario: When the issue modification of the `watch` label is added, find out whether there is a comment created by k that contains `<!-- Created by actions-cool/issues-helper -->`, if so, update the comment, If not, add a comment.
|
||||
|
||||
Of course, if you need such a scene, you can directly use [**Maintain One Comment**](https://github.com/actions-cool/maintain-one-comment).
|
||||
|
||||
```yml
|
||||
name: Test
|
||||
|
||||
on:
|
||||
isssue:
|
||||
issues:
|
||||
types: [edited]
|
||||
|
||||
jobs:
|
||||
@@ -912,32 +985,40 @@ jobs:
|
||||
if: github.event.label.name == 'watch'
|
||||
steps:
|
||||
- name: find comments
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
id: fcid
|
||||
with:
|
||||
actions: 'find-comments'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
comment-auth: k
|
||||
body-includes: 'error'
|
||||
body-includes: '<!-- Created by actions-cool/issues-helper -->'
|
||||
|
||||
# Output view found content. GitHub default outputs are strings
|
||||
- run: echo find-comments ${{ steps.fcid.outputs.comments }}
|
||||
shell: bash
|
||||
|
||||
- name: create comment
|
||||
if: ${{ steps.fcid.outputs.comments.length == 0 }}
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
if: contains(steps.fcid.outputs.comments, '<!-- Created by actions-cool/issues-helper -->') == false
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: 'Some error!'
|
||||
body: |
|
||||
Error
|
||||
<!-- Created by actions-cool/issues-helper -->
|
||||
|
||||
- name: update comment
|
||||
if: ${{ steps.fcid.outputs.comments.length == 1 }}
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
if: contains(steps.fcid.outputs.comments, '<!-- Created by actions-cool/issues-helper -->') == true
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
comment-id: ${{ steps.fcid.outputs.comments[0].id }}
|
||||
body: 'Some error again!'
|
||||
out-comments: ${{ steps.fcid.outputs.comments }}
|
||||
body: |
|
||||
Error Again
|
||||
<!-- Created by actions-cool/issues-helper -->
|
||||
update-mode: 'append'
|
||||
```
|
||||
|
||||
@@ -956,7 +1037,14 @@ Need to have the person token with push permission.
|
||||
- `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).
|
||||
When the token is not filled in actions or input `${{ secrets.GITHUB_TOKEN }}`, it will default to `github-actions-bot`. [More](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow).
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
### 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)
|
||||
|
||||
@@ -964,7 +1052,7 @@ When the token is not filled in actions or the corresponding secrets are not add
|
||||
|
||||
```yml
|
||||
- name: Create issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
id: createissue
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
@@ -973,12 +1061,10 @@ 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 }}"
|
||||
```
|
||||
|
||||
[More](https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs).
|
||||
More:
|
||||
|
||||
### 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)
|
||||
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
|
||||
2. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
|
||||
|
||||
⏫ [Back to list](#List)
|
||||
|
||||
@@ -1038,22 +1124,31 @@ Click the `···` icon in the upper right corner of a comment, select `Copy lin
|
||||
- Use two-level semantic version, such as v1, v1.1, v2, v2.1
|
||||
- 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
|
||||
- When the released v1.x runs stable for a certain period of time or undergoes refactoring, release the advanced v2 version
|
||||
- After the v2 version, the version will be released strictly according to the three-level semantics, such as v2.0.0, v2.1.0
|
||||
|
||||
- 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
|
||||
- The latest v1.x release code will be merged into the 1.x branch
|
||||
- It also supports the direct use of branch versions. Such as:
|
||||
|
||||
```yml
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@main
|
||||
|
||||
# or
|
||||
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@1.x
|
||||
```
|
||||
|
||||
- v2 [upgrade reference](https://github.com/actions-cool/issues-helper/blob/fix/docs/guide/faq.en-US.md#what-should-i-pay-attention-to-when-upgrading-from-v1x-to-v2)
|
||||
|
||||
## 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
|
||||
- Personal exercises and tests [Actions](https://github.com/actions-cool/test-issues-helper) repository
|
||||
- Can also refer to the warehouse of [online users](#who-is-using)
|
||||
|
||||
## ⚡ Feedback
|
||||
|
193
README.md
193
README.md
@@ -5,9 +5,11 @@
|
||||
[](https://github.com/actions-cool/issues-helper/actions)
|
||||
[](https://github.com/marketplace/actions/issues-helper)
|
||||
[](https://github.com/umijs/dumi)
|
||||
[](https://github.com/prettier/prettier)
|
||||
|
||||
[](https://github.com/actions-cool/issues-helper/releases)
|
||||
[](https://github.com/actions-cool/issues-helper/discussions)
|
||||
[](https://github.com/actions-cool/issues-helper/stargazers)
|
||||
[](https://github.com/actions-cool/issues-helper/discussions)
|
||||
[](https://github.com/actions-cool/issues-helper/blob/main/LICENSE)
|
||||
|
||||
一个轻松帮你自动管理 issues 的 GitHub Action
|
||||
@@ -49,11 +51,32 @@
|
||||
<div>dumi</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/vuejs/jsx-next">
|
||||
<img src="https://avatars.githubusercontent.com/u/6128107?s=200&v=4" width="46" />
|
||||
<div>jsx-next</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/mui-org/material-ui">
|
||||
<img src="https://avatars2.githubusercontent.com/u/33663932?s=200&v=4" width="46" />
|
||||
<div>material-ui</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/prettier/prettier">
|
||||
<img src="https://github.com/prettier/prettier-logo/blob/master/images/prettier-icon-light.png?raw=true" width="46" />
|
||||
<div>prettier</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/ant-design/pro-components">
|
||||
<img src="https://avatars1.githubusercontent.com/u/12101536?s=200&v=4" width="46" />
|
||||
<div>pro-components</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/react-component">
|
||||
<img src="https://avatars3.githubusercontent.com/u/9441414?s=200&v=4" width="46" />
|
||||
<div>react-component</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/lijinke666/react-music-player">
|
||||
<img src="https://github.com/lijinke666/react-music-player/blob/master/assetsImg/logo.png?raw=true" width="46" />
|
||||
@@ -64,12 +87,17 @@
|
||||
<img src="https://avatars1.githubusercontent.com/u/33895495?s=200&v=4" width="46" />
|
||||
<div>umi</div>
|
||||
</a></td>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/vitejs/vite">
|
||||
<img src="https://avatars.githubusercontent.com/u/65625612?s=200&v=4" width="46" />
|
||||
<div>vite</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/AttoJS/vue-request">
|
||||
<img src="https://raw.githubusercontent.com/AttoJS/art/master/vue-request-logo.png" width="46" />
|
||||
<div>vue-request</div>
|
||||
</a></td>
|
||||
</tr><tr>
|
||||
<td align="center" width="180">
|
||||
<a href="https://github.com/zoo-js/zoo">
|
||||
<img src="https://avatars1.githubusercontent.com/u/70757173?s=200&v=4" width="46" />
|
||||
@@ -77,7 +105,6 @@
|
||||
</a></td>
|
||||
<td align="center" width="180"></td>
|
||||
<td align="center" width="180"></td>
|
||||
<td align="center" width="180"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -91,6 +118,7 @@
|
||||
- [`close-issue`](#close-issue)
|
||||
- [`create-comment`](#create-comment)
|
||||
- [`create-issue`](#create-issue)
|
||||
- [`create-label`](#create-label)
|
||||
- [`delete-comment`](#delete-comment)
|
||||
- [`lock-issue`](#lock-issue)
|
||||
- [`mark-duplicate`](#mark-duplicate)
|
||||
@@ -134,7 +162,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add assigness
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -176,7 +204,7 @@ jobs:
|
||||
if: contains(github.event.issue.body, 'xxx') == false
|
||||
steps:
|
||||
- name: Add labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -201,7 +229,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Close issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -234,7 +262,7 @@ jobs:
|
||||
if: github.event.label.name == 'xxx'
|
||||
steps:
|
||||
- name: Create comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -278,7 +306,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -305,13 +333,41 @@ jobs:
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
#### `create-label`
|
||||
|
||||
新增 label。若想批量维护 labels,[可查看](https://github.com/actions-cool/labels-helper)。
|
||||
|
||||
```yml
|
||||
- name: Create label
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-label'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
label-name: 'xx'
|
||||
label-color: '0095b3'
|
||||
label-desc: 'xx'
|
||||
```
|
||||
|
||||
| 参数 | 描述 | 类型 | 必填 |
|
||||
| -- | -- | -- | -- |
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](#token) | string | ✔ |
|
||||
| label-name | 标签名称,支持 emoji | string | ✔ |
|
||||
| label-color | 标签颜色,格式为 16 进制色码,不加 `#` | string | ✖ |
|
||||
| label-desc | 标签描述 | string | ✖ |
|
||||
|
||||
- `label-name`:若已存在,则无操作
|
||||
- `label-color`:默认为 `ededed`
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
#### `delete-comment`
|
||||
|
||||
根据 [`comment-id`](#comment-id) 删除指定评论。
|
||||
|
||||
```yml
|
||||
- name: Delete comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'delete-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -323,6 +379,9 @@ jobs:
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](#token) | string | ✔ |
|
||||
| comment-id | 指定的 comment | number | ✔ |
|
||||
| out-comments | `find-comments` 的输出,若查找多个,则操作多个 | string | ✖ |
|
||||
|
||||
- 当 `out-comments` 输入时,`comment-id` 不起作用
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
@@ -343,7 +402,7 @@ jobs:
|
||||
if: github.event.label.name == 'invalid'
|
||||
steps:
|
||||
- name: Lock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -355,26 +414,29 @@ jobs:
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](#token) | string | ✔ |
|
||||
| issue-number | 指定的 issue | number | ✔ |
|
||||
| lock-reason | 锁定 issue 的原因 | string | ✖ |
|
||||
|
||||
- `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam`
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
#### `mark-duplicate`
|
||||
|
||||
快捷标记重复问题,仅作用于 issue 新增评论。
|
||||
快捷标记重复问题,仅作用于 issue 新增编辑评论。
|
||||
|
||||
```yml
|
||||
name: Issue Mark Duplicate
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
mark-duplicate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: mark-duplicate
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'mark-duplicate'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -390,10 +452,16 @@ jobs:
|
||||
| labels | 替换该 issue 的 labels | string | ✖ |
|
||||
| contents | 为该评论的增加 [reaction](#reactions-types) | string | ✖ |
|
||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||
| require-permission | 要求权限,默认为 `write` | string | ✖ |
|
||||
|
||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`
|
||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||
- `labels`:优先级最高
|
||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||
- `require-permission`:可选值有 `admin`,`write`,`read`,`none`
|
||||
- 团队成员若设置 `read` 权限,则为 `read`
|
||||
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
|
||||
- 普通用户为 `read` 权限
|
||||
- 当设置 `write` 后,`admin` 和 `write` 满足条件
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
@@ -403,7 +471,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Open issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'open-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -424,7 +492,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Remove assignees
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -447,7 +515,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Remove labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -472,7 +540,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Set labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'set-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -495,7 +563,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Unlock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'unlock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -528,7 +596,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -541,12 +609,14 @@ jobs:
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](#token) | string | ✔ |
|
||||
| comment-id | 指定的 comment | number | ✔ |
|
||||
| out-comments | `find-comments` 的输出,若查找多个,则操作多个 | string | ✖ |
|
||||
| body | 更新 comment 的内容 | string | ✖ |
|
||||
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ |
|
||||
| contents | 增加 [reaction](#reactions-types) | string | ✖ |
|
||||
|
||||
- `body` 不填时,会保持原有
|
||||
- `update-mode` 为 `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
|
||||
- 当 `out-comments` 输入时,`comment-id` 不起作用
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
@@ -556,7 +626,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Update issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -604,7 +674,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: welcome
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'welcome'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -647,7 +717,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-inactive
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-inactive'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -696,7 +766,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -735,7 +805,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: close-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -769,7 +839,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Find comments
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'find-comments'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -817,7 +887,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: lock-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -839,6 +909,7 @@ jobs:
|
||||
| body-includes | 包含内容筛选 | string | ✖ |
|
||||
| title-includes | 包含标题筛选 | string | ✖ |
|
||||
| inactive-day | 非活跃天数筛选 | number | ✖ |
|
||||
| lock-reason | 锁定 issue 的原因 | string | ✖ |
|
||||
|
||||
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
|
||||
- `issue-state`:默认为 `open`。可选值 `all` `closed`,非这 2 项时,均为 `open`
|
||||
@@ -863,7 +934,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: month-statistics
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'month-statistics'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -891,13 +962,15 @@ jobs:
|
||||
|
||||
### `find-comments + create-comment + update-comment`
|
||||
|
||||
假设场景:当添加了 `watch` label 的 issue 修改时,查找是否有 k 创建的包含 `error` 的评论,如果只有一个,则更新该 comment,如果没有,则新增一个 comment。
|
||||
假设场景:当添加了 `watch` label 的 issue 修改时,查找是否有 k 创建的包含 `<!-- Created by actions-cool/issues-helper -->` 的评论,如果有,则更新 comment,如果没有,则新增一个 comment。
|
||||
|
||||
当然,如果你需要这样的场景,可以直接使用 [**Maintain One Comment**](https://github.com/actions-cool/maintain-one-comment)。
|
||||
|
||||
```yml
|
||||
name: Test
|
||||
|
||||
on:
|
||||
isssue:
|
||||
issues:
|
||||
types: [edited]
|
||||
|
||||
jobs:
|
||||
@@ -906,32 +979,40 @@ jobs:
|
||||
if: github.event.label.name == 'watch'
|
||||
steps:
|
||||
- name: find comments
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
id: fcid
|
||||
with:
|
||||
actions: 'find-comments'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
comment-auth: k
|
||||
body-includes: 'error'
|
||||
body-includes: '<!-- Created by actions-cool/issues-helper -->'
|
||||
|
||||
# 输出查看找到的内容。GitHub 默认 outputs 为字符串
|
||||
- run: echo find-comments ${{ steps.fcid.outputs.comments }}
|
||||
shell: bash
|
||||
|
||||
- name: create comment
|
||||
if: ${{ steps.fcid.outputs.comments.length == 0 }}
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
if: contains(steps.fcid.outputs.comments, '<!-- Created by actions-cool/issues-helper -->') == false
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: 'Some error!'
|
||||
body: |
|
||||
Error
|
||||
<!-- Created by actions-cool/issues-helper -->
|
||||
|
||||
- name: update comment
|
||||
if: ${{ steps.fcid.outputs.comments.length == 1 }}
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
if: contains(steps.fcid.outputs.comments, '<!-- Created by actions-cool/issues-helper -->') == true
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
comment-id: ${{ steps.fcid.outputs.comments[0].id }}
|
||||
body: 'Some error again!'
|
||||
out-comments: ${{ steps.fcid.outputs.comments }}
|
||||
body: |
|
||||
Error Again
|
||||
<!-- Created by actions-cool/issues-helper -->
|
||||
update-mode: 'append'
|
||||
```
|
||||
|
||||
@@ -950,7 +1031,14 @@ jobs:
|
||||
- `Name` 与 actions 中保持一致
|
||||
- `Value` 填写刚才个人申请的 token
|
||||
|
||||
当 actions 不填写 token 时,或项目未添加对应 secrets 时,会默认为 github-actions <kbd>bot</kbd>。[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow)。
|
||||
当 actions 不填写 token 时,或填写 `${{ secrets.GITHUB_TOKEN }}`,会默认为 `github-actions-bot`。[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow)。
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
### 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)
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
@@ -958,7 +1046,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Create issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
id: createissue
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
@@ -967,12 +1055,10 @@ jobs:
|
||||
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
|
||||
|
||||
- [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)
|
||||
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
|
||||
2. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
|
||||
|
||||
⏫ [返回列表](#列-表)
|
||||
|
||||
@@ -1033,22 +1119,31 @@ x2 + y2
|
||||
- 采用两级语义化版本,如v1、v1.1、v2、v2.1
|
||||
- v1 表示初始版本
|
||||
- 对 v1 版本的修复和新增会发布到 v1.1 版本
|
||||
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
|
||||
- 当发布的 v1.x 运行一定时间稳定或进行重构时,发布进阶 v2 版本
|
||||
- v2 版本后会严格按照三级语义来发布版本,如 v2.0.0、v2.1.0
|
||||
|
||||
- 版本选择
|
||||
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
|
||||
- 同时也可参照下面的更新日志来选择版本
|
||||
- 也支持直接使用分支版本。如:
|
||||
- 最新的 v1.x release 代码会合并到 1.x 分支中
|
||||
- 支持直接使用分支版本。如:
|
||||
|
||||
```yml
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@main
|
||||
|
||||
# or
|
||||
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@1.x
|
||||
```
|
||||
|
||||
- v2 [升级参考](https://github.com/actions-cool/issues-helper/blob/fix/docs/guide/faq.md#%E4%BB%8E-v1x-%E5%8D%87%E7%BA%A7%E5%88%B0-v2%E6%9C%89%E4%BB%80%E4%B9%88%E6%B3%A8%E6%84%8F%E7%9A%84%E5%9C%B0%E6%96%B9%E5%90%97)
|
||||
|
||||
## Actions 模板
|
||||
|
||||
- 可直接使用这个 [GitHub Actions workflow template](https://github.com/actions-cool/.github) 仓库的模板
|
||||
- 个人练习和测试 [Actions](https://github.com/xrkffgg/test-ci) 的仓库
|
||||
- 个人练习和测试 [Actions](https://github.com/actions-cool/test-issues-helper) 的仓库
|
||||
- 也可以来 [线上使用者](#谁在使用) 的仓库参照
|
||||
|
||||
## ⚡ 反馈
|
||||
|
20
USERS.js
20
USERS.js
@@ -37,6 +37,26 @@ const users = [
|
||||
url: 'https://github.com/zoo-js/zoo',
|
||||
logo: 'https://avatars1.githubusercontent.com/u/70757173?s=200&v=4'
|
||||
},
|
||||
{
|
||||
url: 'https://github.com/react-component',
|
||||
logo: 'https://avatars3.githubusercontent.com/u/9441414?s=200&v=4'
|
||||
},
|
||||
{
|
||||
url: 'https://github.com/ant-design/pro-components',
|
||||
logo: 'https://avatars1.githubusercontent.com/u/12101536?s=200&v=4'
|
||||
},
|
||||
{
|
||||
url: 'https://github.com/prettier/prettier',
|
||||
logo: 'https://github.com/prettier/prettier-logo/blob/master/images/prettier-icon-light.png?raw=true'
|
||||
},
|
||||
{
|
||||
url: 'https://github.com/vuejs/jsx-next',
|
||||
logo: 'https://avatars.githubusercontent.com/u/6128107?s=200&v=4'
|
||||
},
|
||||
{
|
||||
url: 'https://github.com/vitejs/vite',
|
||||
logo: 'https://avatars.githubusercontent.com/u/65625612?s=200&v=4'
|
||||
},
|
||||
];
|
||||
|
||||
// **************************************************************************
|
||||
|
16
action.yml
16
action.yml
@@ -22,8 +22,16 @@ inputs:
|
||||
description: 'Issue assignees'
|
||||
random-to:
|
||||
description: 'Issue assignees random to'
|
||||
# label
|
||||
labels:
|
||||
description: 'Issue labels'
|
||||
label-name:
|
||||
description: 'Create label name'
|
||||
label-color:
|
||||
description: 'Create label color, default #ededed'
|
||||
label-desc:
|
||||
description: 'Create label description'
|
||||
|
||||
state:
|
||||
description: 'Issue state'
|
||||
update-mode:
|
||||
@@ -32,8 +40,12 @@ inputs:
|
||||
description: 'Issue reactions emoji'
|
||||
direction:
|
||||
description: 'Find comments direction'
|
||||
|
||||
# comments
|
||||
comment-auth:
|
||||
description: 'Find comments query auth'
|
||||
out-comments:
|
||||
description: 'Find comments out comments'
|
||||
assignee-includes:
|
||||
description: 'Check use'
|
||||
body-includes:
|
||||
@@ -52,12 +64,16 @@ inputs:
|
||||
description: 'Query use'
|
||||
inactive-day:
|
||||
description: 'Query use'
|
||||
lock-reason:
|
||||
description: 'The reason lock issue'
|
||||
inactive-label:
|
||||
description: 'Issue label set use'
|
||||
duplicate-command:
|
||||
description: 'For mark-duplicate'
|
||||
duplicate-labels:
|
||||
description: 'For mark-duplicate add labels'
|
||||
require-permission:
|
||||
description: 'Only the allow can do. Possible admin, write, read, and none.'
|
||||
remove-labels:
|
||||
description: 'For remove labels'
|
||||
close-issue:
|
||||
|
680
dist/index.js
vendored
680
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-inactive
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-inactive'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -73,7 +73,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -110,7 +110,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: close-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -142,7 +142,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
|
||||
|
||||
```yml
|
||||
- name: Find comments
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'find-comments'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -188,7 +188,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: lock-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -210,6 +210,7 @@ jobs:
|
||||
| body-includes | Body filtering | string | ✖ |
|
||||
| title-includes | Title filtering | string | ✖ |
|
||||
| inactive-day | Inactive days filtering | number | ✖ |
|
||||
| lock-reason | Reason for locking issue | string | ✖ |
|
||||
|
||||
- `labels`: When there are multiple, the query will have multiple at the same time. If not entered, all
|
||||
- `issue-state`: The default is `all`. Optional value `open` `closed`, when these 2 items are not, both are `all`
|
||||
@@ -232,7 +233,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: month-statistics
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'month-statistics'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@@ -22,7 +22,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-inactive
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-inactive'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -69,7 +69,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'check-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -106,7 +106,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: close-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -138,7 +138,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Find comments
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'find-comments'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -184,7 +184,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: lock-issues
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issues'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -206,6 +206,7 @@ jobs:
|
||||
| body-includes | 包含内容筛选 | string | ✖ |
|
||||
| title-includes | 包含标题筛选 | string | ✖ |
|
||||
| inactive-day | 非活跃天数筛选 | number | ✖ |
|
||||
| lock-reason | 锁定 issue 的原因 | string | ✖ |
|
||||
|
||||
- `labels`:为多个时,会查询同时拥有多个。不填时,会查询所有
|
||||
- `issue-state`:默认为 `all`。可选值 `open` `closed`,非这 2 项时,均为 `all`
|
||||
@@ -228,7 +229,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: month-statistics
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'month-statistics'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@@ -22,7 +22,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add assigness
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
if: contains(github.event.issue.body, 'xxx') == false
|
||||
steps:
|
||||
- name: Add labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -85,7 +85,7 @@ Close the specified issue.
|
||||
|
||||
```yml
|
||||
- name: Close issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
if: github.event.label.name == 'xxx'
|
||||
steps:
|
||||
- name: Create comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -158,7 +158,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -183,13 +183,39 @@ jobs:
|
||||
- `title` default is `Default Title`
|
||||
- Return `issue-number`. [Usage reference](/en-US/guide/ref#-outputs-use)
|
||||
|
||||
## `create-label`
|
||||
|
||||
Create label. If you want to maintain labels in batches, [see](https://github.com/actions-cool/labels-helper).
|
||||
|
||||
```yml
|
||||
- name: Create label
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-label'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
label-name: 'xx'
|
||||
label-color: '0095b3'
|
||||
label-desc: 'xx'
|
||||
```
|
||||
|
||||
| Param | Desc | Type | Required |
|
||||
| -- | -- | -- | -- |
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
|
||||
| label-name | Label name, emoji support | string | ✔ |
|
||||
| label-color | Label color, the format is hexadecimal color code, without `#` | string | ✖ |
|
||||
| label-desc | Label description | string | ✖ |
|
||||
|
||||
- `label-name`: If it already exists, no operation
|
||||
- `label-color`: Default is `ededed`
|
||||
|
||||
## `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.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'delete-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -201,6 +227,9 @@ According to [`comment-id`](/en-US/guide/ref#-comment-id) delete the specified c
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
|
||||
| comment-id | The comment ID | number | ✔ |
|
||||
| out-comments | The output of `find-comments`, if you find multiple, operate multiple | string | ✖ |
|
||||
|
||||
- When `out-comments` is entered, `comment-id` does not work
|
||||
|
||||
## `lock-issue`
|
||||
|
||||
@@ -219,7 +248,7 @@ jobs:
|
||||
if: github.event.label.name == 'invalid'
|
||||
steps:
|
||||
- name: Lock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -231,24 +260,27 @@ jobs:
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
|
||||
| issue-number | The number of issue | number | ✔ |
|
||||
| lock-reason | Reason for locking issue | string | ✖ |
|
||||
|
||||
- `lock-reason`: Optional values are `off-topic` `too heated` `resolved` `spam`
|
||||
|
||||
## `mark-duplicate`
|
||||
|
||||
Quickly mark duplicate questions, only for issue new comments.
|
||||
Quickly mark duplicate questions, only for issue new comments or edit comments.
|
||||
|
||||
```yml
|
||||
name: Issue Mark Duplicate
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
mark-duplicate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: mark-duplicate
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'mark-duplicate'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -264,10 +296,16 @@ jobs:
|
||||
| labels | Replace the labels of the issue | string | ✖ |
|
||||
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) for this comment | string | ✖ |
|
||||
| close-issue | Whether to close the issue at the same time | string | ✖ |
|
||||
| require-permission | Permission required, default is `write` | string | ✖ |
|
||||
|
||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`
|
||||
- `duplicate-command`: When setting concise commands, while still supporting the original `Duplicate of`. Block content contains `?`
|
||||
- `labels`: Highest priority
|
||||
- `close-issue`: Both `true` or `'true'` can take effect
|
||||
- `require-permission`: Optional values are `admin`, `write`, `read`, `none`
|
||||
- If the team member sets the `read` permission, it is `read`
|
||||
- If the external Collaborator is set to `read` permission, it is `read`
|
||||
- Ordinary users have `read` permission
|
||||
- When set `write`, `admin` and `write` meet the conditions
|
||||
|
||||
<Alert>
|
||||
Note: Duplicate created with the concise command does not display the content of the red box in the figure below. But in fact this has no effect.
|
||||
@@ -281,7 +319,7 @@ Open the specified issue.
|
||||
|
||||
```yml
|
||||
- name: Open issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'open-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -300,7 +338,7 @@ Remove the person designated by issue.
|
||||
|
||||
```yml
|
||||
- name: Remove assignees
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -321,7 +359,7 @@ Remove the specified labels.
|
||||
|
||||
```yml
|
||||
- name: Remove labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -344,7 +382,7 @@ Replace the labels of issue.
|
||||
|
||||
```yml
|
||||
- name: Set labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'set-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -365,7 +403,7 @@ Unlock the specified issue.
|
||||
|
||||
```yml
|
||||
- name: Unlock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'unlock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -396,7 +434,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -409,12 +447,14 @@ jobs:
|
||||
| actions | Action type | string | ✔ |
|
||||
| token | [Token explain](/en-US/guide/ref#-token) | string | ✔ |
|
||||
| comment-id | The comment ID | number | ✔ |
|
||||
| out-comments | The output of `find-comments`, if you find multiple, operate multiple | string | ✖ |
|
||||
| body | Update the content of comment | string | ✖ |
|
||||
| update-mode | Update mode. Default `replace`, another `append` | string | ✖ |
|
||||
| contents | Add [reaction](/en-US/guide/ref#-reactions-type) | string | ✖ |
|
||||
|
||||
- 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`
|
||||
- When `out-comments` is entered, `comment-id` does not work
|
||||
|
||||
## `update-issue`
|
||||
|
||||
@@ -422,7 +462,7 @@ Update the specified issue according to the `issue-number`.
|
||||
|
||||
```yml
|
||||
- name: Update issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -470,7 +510,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: welcome
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'welcome'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
78
docs/base.md
78
docs/base.md
@@ -22,7 +22,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Add assigness
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
if: contains(github.event.issue.body, 'xxx') == false
|
||||
steps:
|
||||
- name: Add labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'add-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Close issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'close-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
if: github.event.label.name == 'xxx'
|
||||
steps:
|
||||
- name: Create comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -158,7 +158,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -183,13 +183,39 @@ jobs:
|
||||
- `title` 默认为:`Default Title`
|
||||
- 返回 `issue-number`,[用法参考](/guide/ref#-outputs-使用)
|
||||
|
||||
## `create-label`
|
||||
|
||||
新增 label。若想批量维护 labels,[可查看](https://github.com/actions-cool/labels-helper)。
|
||||
|
||||
```yml
|
||||
- name: Create label
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-label'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
label-name: 'xx'
|
||||
label-color: '0095b3'
|
||||
label-desc: 'xx'
|
||||
```
|
||||
|
||||
| 参数 | 描述 | 类型 | 必填 |
|
||||
| -- | -- | -- | -- |
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
|
||||
| label-name | 标签名称,支持 emoji | string | ✔ |
|
||||
| label-color | 标签颜色,格式为 16 进制色码,不加 `#` | string | ✖ |
|
||||
| label-desc | 标签描述 | string | ✖ |
|
||||
|
||||
- `label-name`:若已存在,则无操作
|
||||
- `label-color`:默认为 `ededed`
|
||||
|
||||
## `delete-comment`
|
||||
|
||||
根据 [`comment-id`](/guide/ref#-comment-id) 删除指定评论。
|
||||
|
||||
```yml
|
||||
- name: Delete comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'delete-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -201,6 +227,9 @@ jobs:
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
|
||||
| comment-id | 指定的 comment | number | ✔ |
|
||||
| out-comments | `find-comments` 的输出,若查找多个,则操作多个 | string | ✖ |
|
||||
|
||||
- 当 `out-comments` 输入时,`comment-id` 不起作用
|
||||
|
||||
## `lock-issue`
|
||||
|
||||
@@ -219,7 +248,7 @@ jobs:
|
||||
if: github.event.label.name == 'invalid'
|
||||
steps:
|
||||
- name: Lock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'lock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -231,24 +260,27 @@ jobs:
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
|
||||
| issue-number | 指定的 issue | number | ✔ |
|
||||
| lock-reason | 锁定 issue 的原因 | string | ✖ |
|
||||
|
||||
- `lock-reason`:可选值有 `off-topic` `too heated` `resolved` `spam`
|
||||
|
||||
## `mark-duplicate`
|
||||
|
||||
快捷标记重复问题,仅作用于 issue 新增评论。
|
||||
快捷标记重复问题,仅作用于 issue 新增编辑评论。
|
||||
|
||||
```yml
|
||||
name: Issue Mark Duplicate
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
types: [created, edited]
|
||||
|
||||
jobs:
|
||||
mark-duplicate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: mark-duplicate
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'mark-duplicate'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -264,10 +296,16 @@ jobs:
|
||||
| labels | 替换该 issue 的 labels | string | ✖ |
|
||||
| contents | 为该评论的增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
|
||||
| close-issue | 是否同时关闭该 issue | string | ✖ |
|
||||
| require-permission | 要求权限,默认为 `write` | string | ✖ |
|
||||
|
||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`
|
||||
- `duplicate-command`:当设置简洁命令时,同时仍支持原有 `Duplicate of`。屏蔽内容包含 `?`
|
||||
- `labels`:优先级最高
|
||||
- `close-issue`:`true` 或 `'true'` 均可生效
|
||||
- `require-permission`:可选值有 `admin`,`write`,`read`,`none`
|
||||
- 团队成员若设置 `read` 权限,则为 `read`
|
||||
- 外部 Collaborator 若设置 `read` 权限,则为 `read`
|
||||
- 普通用户为 `read` 权限
|
||||
- 当设置 `write` 后,`admin` 和 `write` 满足条件
|
||||
|
||||
<Alert>
|
||||
注意:使用简洁命令创建的 Duplicate 不显示下图红框内容。但其实这个没有任何影响的。
|
||||
@@ -281,7 +319,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Open issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'open-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -300,7 +338,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Remove assignees
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-assignees'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -321,7 +359,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Remove labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'remove-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -344,7 +382,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Set labels
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'set-labels'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -365,7 +403,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Unlock issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'unlock-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -396,7 +434,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update comment
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -409,12 +447,14 @@ jobs:
|
||||
| actions | 操作类型 | string | ✔ |
|
||||
| token | [token 说明](/guide/ref#-token-说明) | string | ✔ |
|
||||
| comment-id | 指定的 comment | number | ✔ |
|
||||
| out-comments | `find-comments` 的输出,若查找多个,则操作多个 | string | ✖ |
|
||||
| body | 更新 comment 的内容 | string | ✖ |
|
||||
| update-mode | 更新模式。默认 `replace` 替换,`append` 附加 | string | ✖ |
|
||||
| contents | 增加 [reaction](/guide/ref#-reactions-类型) | string | ✖ |
|
||||
|
||||
- `body` 不填时,会保持原有
|
||||
- `update-mode` 为 `append` 时,会进行附加操作。非 `append` 都会进行替换。仅对 `body` 生效
|
||||
- 当 `out-comments` 输入时,`comment-id` 不起作用
|
||||
|
||||
## `update-issue`
|
||||
|
||||
@@ -422,7 +462,7 @@ jobs:
|
||||
|
||||
```yml
|
||||
- name: Update issue
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'update-issue'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -469,7 +509,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: welcome
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'welcome'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@@ -8,16 +8,25 @@ toc: menu
|
||||
- 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
|
||||
- When the released v1.x runs stable for a certain period of time or undergoes refactoring, release the advanced v2 version
|
||||
- After the v2 version, the version will be released strictly according to the three-level semantics, such as v2.0.0, v2.1.0
|
||||
|
||||
- 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
|
||||
- The latest v1.x release code will be merged into the 1.x branch
|
||||
- It also supports the direct use of branch versions. Such as:
|
||||
|
||||
```yml
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@main
|
||||
|
||||
# or
|
||||
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@1.x
|
||||
```
|
||||
|
||||
- v2 [upgrade reference](/en-US/guide/faq)
|
||||
|
||||
<embed src="../CHANGELOG.md"></embed>
|
||||
|
@@ -8,16 +8,25 @@ toc: menu
|
||||
- 采用两级语义化版本,如v1、v1.1、v2、v2.1
|
||||
- v1 表示初始版本
|
||||
- 对 v1 版本的修复和新增会发布到 v1.1 版本
|
||||
- 当发布的 v1.x 运行一定时间稳定后,发布进阶 v2 版本
|
||||
- 当发布的 v1.x 运行一定时间稳定或进行重构时,发布进阶 v2 版本
|
||||
- v2 版本后会严格按照三级语义来发布版本,如 v2.0.0、v2.1.0
|
||||
|
||||
- 版本选择
|
||||
- 建议采用最新 releases 版本。可在 [releases](https://github.com/actions-cool/issues-helper/releases) 看到
|
||||
- 同时也可参照下面的更新日志来选择版本
|
||||
- 也支持直接使用分支版本。如:
|
||||
- 最新的 v1.x release 代码会合并到 1.x 分支中
|
||||
- 支持直接使用分支版本。如:
|
||||
|
||||
```yml
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@main
|
||||
|
||||
# or
|
||||
|
||||
- name: Issues Helper
|
||||
uses: actions-cool/issues-helper@1.x
|
||||
```
|
||||
|
||||
- v2 [升级参考](/guide/faq)
|
||||
|
||||
<embed src="../CHANGELOG.md"></embed>
|
||||
|
@@ -6,12 +6,16 @@ toc: menu
|
||||
|
||||
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.
|
||||
|
||||
### Is there a rate limit?
|
||||
|
||||
Yes. The bottom layer of Action uses GitHub REST API. The general situation is 5000 times per hour. It is basically sufficient in principle, and it is also required to avoid invalid requests when defining Action. [Detailed view](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting).
|
||||
|
||||
## 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
|
||||
2. Personal exercises and tests [Actions](https://github.com/actions-cool/test-issues-helper) 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?
|
||||
@@ -22,6 +26,10 @@ Yes, you can directly modify `actions`. For example: `actions:'create-comment'`
|
||||
|
||||
You can view the detailed [changelog](/en-US/changelog). The latest releases version is recommended.
|
||||
|
||||
## What should I pay attention to when upgrading from v1.x to v2?
|
||||
|
||||
There is only one difference between v1.12 and v2.0.0. That is, `require-permission` in `mark-duplicate` has added the default value `write`.
|
||||
|
||||
## 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).
|
||||
|
@@ -6,12 +6,16 @@ toc: menu
|
||||
|
||||
GitHub Actions 是由 GitHub 免费提供的。其中 `Private` 项目每月有 2000 次的限制,[具体查看](https://github.com/settings/billing)。`Public` 项目无限制。
|
||||
|
||||
### 有没有速率的限制?
|
||||
|
||||
有的。Action 底层使用的是 GitHub REST API。一般情况是每小时 5000 次。原则上基本是够用的,同时也要求在 Action 定义时,尽量避免无效的请求。[具体查看](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting)。
|
||||
|
||||
## 有没有现成的模板可以参考?
|
||||
|
||||
有的。
|
||||
|
||||
1. 你可以使用这个 [GitHub Actions workflow template](https://github.com/actions-cool/.github) 仓库的模板
|
||||
2. 个人练习和测试 [Actions](https://github.com/xrkffgg/test-ci) 的仓库
|
||||
2. 个人练习和测试 [Actions](https://github.com/actions-cool/test-issues-helper) 的仓库
|
||||
3. 也可以来 [线上使用者](/#-谁在使用?) 的仓库参照
|
||||
|
||||
## 我想暂停 Actions,有没有简单的办法?
|
||||
@@ -22,6 +26,10 @@ GitHub Actions 是由 GitHub 免费提供的。其中 `Private` 项目每月有
|
||||
|
||||
你可以查看详细的 [更新日志](/changelog)。推荐采用最新 releases 版本。
|
||||
|
||||
## 从 v1.x 升级到 v2,有什么注意的地方吗?
|
||||
|
||||
v1.12 和 v2.0.0 版本的差别只有一处。即 `mark-duplicate` 中的 `require-permission` 增加了默认值 `write`。
|
||||
|
||||
## 如果这里没有我想要的功能,该怎么办?
|
||||
|
||||
你可以在 [What do you want?](https://github.com/actions-cool/issues-helper/discussions/18) 中提出。
|
||||
|
@@ -28,7 +28,7 @@ with:
|
||||
|
||||
- `count-lables`: Regardless of setting `true` or `'ture'`, all received in the program is in string format
|
||||
|
||||
At the same time, the output is also in string format
|
||||
At the same time, the output is also in string format. [See](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs).
|
||||
|
||||
- `check-result`: The judgment condition is `if: steps.xxid.outputs.check-result =='true'`
|
||||
|
||||
@@ -38,6 +38,8 @@ When an action is set, such as adding a label `x1` to an issue, Actions will aut
|
||||
|
||||
But if this is done by `GitHub Actions bot` (that is, the token in the actions is not passed, or the default `token: ${{ secrets.GITHUB_TOKEN }}` is used), the actions of label `x2` will not be triggered.
|
||||
|
||||
ref: [GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token)
|
||||
|
||||
## `assignees` scope
|
||||
|
||||
- The owner or collaborator of the warehouse, if there is an organization, including members
|
||||
|
@@ -29,7 +29,7 @@ with:
|
||||
|
||||
- `count-lables`:不管设置 `true` 还是 `'ture'`,在程序里接收到的都是字符串格式
|
||||
|
||||
同时输出的也是字符串格式
|
||||
同时输出的也是字符串格式。[参看](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs)。
|
||||
|
||||
- `check-result`:判断条件为 `if: steps.xxid.outputs.check-result == 'true'`
|
||||
|
||||
@@ -39,6 +39,8 @@ with:
|
||||
|
||||
但如果这个是由 `GitHub Actions bot` 完成的(即 actions 中 token 不传,或使用默认 `token: ${{ secrets.GITHUB_TOKEN }}`),则不会触发 label `x2` 的 Actions。
|
||||
|
||||
ref: [GitHub docs](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token)
|
||||
|
||||
## `assignees` 范围
|
||||
|
||||
- 仓库的所有者或协作者,若有组织,包括成员
|
||||
|
@@ -13,7 +13,7 @@ Need to have the person token with push permission.
|
||||
- `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).
|
||||
When the token is not filled in actions or input `${{ secrets.GITHUB_TOKEN }}`, 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
|
||||
|
||||
@@ -33,7 +33,10 @@ 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 }}"
|
||||
```
|
||||
|
||||
[More](https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs).
|
||||
More:
|
||||
|
||||
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
|
||||
2. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
|
||||
|
||||
## 📍 `includes` check rules
|
||||
|
||||
|
@@ -13,7 +13,7 @@ toc: menu
|
||||
- `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)。
|
||||
当 actions 不填写 token 时,或输入 `${{ secrets.GITHUB_TOKEN }}`,会默认为 `github-actions-bot`。[更多查看](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow)。
|
||||
|
||||
## 📍 GitHub 相关文档
|
||||
|
||||
@@ -33,7 +33,10 @@ toc: menu
|
||||
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)。
|
||||
更多查看:
|
||||
|
||||
1. https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#outputs
|
||||
2. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
|
||||
|
||||
## 📍 `includes` 校验规则
|
||||
|
||||
|
@@ -33,7 +33,7 @@ jobs:
|
||||
steps:
|
||||
- name: help wanted
|
||||
if: github.event.label.name == 'help wanted'
|
||||
uses: actions-cool/issues-helper@v1.2
|
||||
uses: actions-cool/issues-helper@v2.0.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
- `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
|
||||
- `uses: actions-cool/issues-helper@v2.0.0`。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
|
||||
|
@@ -33,7 +33,7 @@ jobs:
|
||||
steps:
|
||||
- name: help wanted
|
||||
if: github.event.label.name == 'help wanted'
|
||||
uses: actions-cool/issues-helper@v1.2
|
||||
uses: actions-cool/issues-helper@v2.0.0
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
- `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)
|
||||
- `uses: actions-cool/issues-helper@v2.0.0`。版本选择请 [参考](/changelog)
|
||||
- `issues-hepler` 参数
|
||||
- `actions`:使用功能的名称,**必填**。支持多个,需用逗号隔开,如 `create-comment,close-issue` 表示评论和关闭 issue
|
||||
- `token`:需拥有 push 权限的人员 token
|
||||
|
@@ -38,7 +38,7 @@ jobs:
|
||||
steps:
|
||||
- name: help wanted
|
||||
if: github.event.label.name == 'help wanted'
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
|
||||
## 💖 Who is using?
|
||||
|
||||
<embed src="../README.md#L29-L82"></embed>
|
||||
<embed src="../README.md#RE-/<table>[^]+?[\r\n]<\/table>/"></embed>
|
||||
|
||||
## ⚡ Feedback
|
||||
|
||||
|
@@ -38,7 +38,7 @@ jobs:
|
||||
steps:
|
||||
- name: help wanted
|
||||
if: github.event.label.name == 'help wanted'
|
||||
uses: actions-cool/issues-helper@v1.10
|
||||
uses: actions-cool/issues-helper@v2.1.2
|
||||
with:
|
||||
actions: 'create-comment'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
|
||||
## 💖 谁在使用?
|
||||
|
||||
<embed src="../README.md#L29-L82"></embed>
|
||||
<embed src="../README.md#RE-/<table>[^]+?[\r\n]<\/table>/"></embed>
|
||||
|
||||
## ⚡ 反馈
|
||||
|
||||
|
11
package.json
11
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "issue-helper",
|
||||
"version": "1.10.0",
|
||||
"name": "issues-helper",
|
||||
"version": "2.1.2",
|
||||
"private": true,
|
||||
"description": "Some operations on issue.",
|
||||
"main": "src/main.js",
|
||||
@@ -10,6 +10,8 @@
|
||||
"docs-dev:build": "UMI_ENV=dev dumi build",
|
||||
"docs:deploy": "gh-pages -d docs-dist",
|
||||
"deploy": "npm run docs:build && npm run docs:deploy",
|
||||
"format": "prettier --write **/*.ts **/*.js",
|
||||
"format-check": "prettier --check **/*.ts **/*.js",
|
||||
"package": "ncc build src/main.js -o dist",
|
||||
"users": "node ./script/update-users.js",
|
||||
"main": "node ./src/main.js",
|
||||
@@ -19,7 +21,7 @@
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/actions-cool/issue-helper.git",
|
||||
"url": "https://github.com/actions-cool/issues-helper.git",
|
||||
"branch": "main"
|
||||
},
|
||||
"keywords": [
|
||||
@@ -36,10 +38,11 @@
|
||||
"lodash": "^4.17.20"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@umijs/fabric": "^2.5.6",
|
||||
"@vercel/ncc": "^0.25.1",
|
||||
"common-tags": "^1.8.0",
|
||||
"dotenv": "^8.2.0",
|
||||
"dumi": "^1.1.0",
|
||||
"dumi": "^1.1.1",
|
||||
"gh-pages": "^3.1.0",
|
||||
"react": "^17.0.1"
|
||||
}
|
||||
|
@@ -17,13 +17,13 @@ for (let j = 1; j <= row; j++) {
|
||||
let data = '';
|
||||
data = stripIndent`
|
||||
<tr>
|
||||
<td align="center" width="180">${getImg(users[(j-1)*4])}</td>
|
||||
<td align="center" width="180">${getImg(users[(j-1)*4+1])}</td>
|
||||
<td align="center" width="180">${getImg(users[(j-1)*4+2])}</td>
|
||||
<td align="center" width="180">${getImg(users[(j-1)*4+3])}</td>
|
||||
<td align="center" width="180">${getImg(users[(j - 1) * 4])}</td>
|
||||
<td align="center" width="180">${getImg(users[(j - 1) * 4 + 1])}</td>
|
||||
<td align="center" width="180">${getImg(users[(j - 1) * 4 + 2])}</td>
|
||||
<td align="center" width="180">${getImg(users[(j - 1) * 4 + 3])}</td>
|
||||
</tr>`;
|
||||
table += data
|
||||
};
|
||||
table += data;
|
||||
}
|
||||
|
||||
table = `<table>
|
||||
${table}
|
||||
@@ -34,7 +34,7 @@ ${table}
|
||||
// **************************************************************************
|
||||
|
||||
const point = '<table>';
|
||||
const cnPoint= `## 列 表`;
|
||||
const cnPoint = `## 列 表`;
|
||||
const enPoint = `## List`;
|
||||
|
||||
// **************************************************************************
|
||||
@@ -61,22 +61,22 @@ console.log(`🎉 Done en`);
|
||||
|
||||
// **************************************************************************
|
||||
|
||||
function getImg (o) {
|
||||
function getImg(o) {
|
||||
if (o) {
|
||||
return `
|
||||
<a href="${o.url}">
|
||||
<img src="${o.logo}" width="46" />
|
||||
<div>${getName(o)}</div>
|
||||
</a>`
|
||||
</a>`;
|
||||
}
|
||||
return ``
|
||||
};
|
||||
return ``;
|
||||
}
|
||||
|
||||
function getName (o) {
|
||||
function getName(o) {
|
||||
if (o) {
|
||||
return o.url.split('/').slice(-1)[0]
|
||||
return o.url.split('/').slice(-1)[0];
|
||||
}
|
||||
return ``
|
||||
};
|
||||
return ``;
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const { readFileSync, writeFileSync } = require('fs');
|
||||
|
||||
const last = /v1\.9/g;
|
||||
const now = 'v1.10';
|
||||
const last = /v2\.1\.1/g;
|
||||
const now = 'v2.1.2';
|
||||
|
||||
let readme = readFileSync('./README.md', 'utf-8');
|
||||
readme = readme.replace(last, now);
|
||||
|
133
src/advanced.js
133
src/advanced.js
@@ -1,5 +1,5 @@
|
||||
require('dotenv').config();
|
||||
const core = require("@actions/core");
|
||||
const core = require('@actions/core');
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
|
||||
const {
|
||||
@@ -10,17 +10,9 @@ const {
|
||||
doCreateIssue,
|
||||
} = require('./base.js');
|
||||
|
||||
const {
|
||||
doQueryIssues,
|
||||
getIssuesInMonth,
|
||||
getCreatedMonth,
|
||||
} = require('./public.js');
|
||||
const { doQueryIssues, getIssuesInMonth, getCreatedMonth } = require('./public.js');
|
||||
|
||||
const {
|
||||
dealStringToArr,
|
||||
matchKeyword,
|
||||
getPreMonth
|
||||
} = require('./util.js');
|
||||
const { dealStringToArr, matchKeyword, getPreMonth } = require('./util.js');
|
||||
|
||||
// **************************************************************************
|
||||
var dayjs = require('dayjs');
|
||||
@@ -31,22 +23,22 @@ dayjs.extend(utc);
|
||||
const token = core.getInput('token');
|
||||
const octokit = new Octokit({ auth: `token ${token}` });
|
||||
|
||||
let direction = core.getInput("direction");
|
||||
let direction = core.getInput('direction');
|
||||
direction = direction === 'desc' ? 'desc' : 'asc';
|
||||
const commentAuth = core.getInput("comment-auth");
|
||||
const commentAuth = core.getInput('comment-auth');
|
||||
const bodyIncludes = core.getInput('body-includes');
|
||||
const titleIncludes = core.getInput('title-includes');
|
||||
const assigneeIncludes = core.getInput('assignee-includes');
|
||||
|
||||
let issueState = core.getInput("issue-state") || 'open';
|
||||
let issueState = core.getInput('issue-state') || 'open';
|
||||
if (issueState != 'all' && issueState != 'closed') {
|
||||
issueState = 'open';
|
||||
}
|
||||
|
||||
const inactiveLabel = core.getInput("inactive-label") || 'inactive';
|
||||
const inactiveLabel = core.getInput('inactive-label') || 'inactive';
|
||||
|
||||
// **************************************************************************
|
||||
async function doCheckInactive (owner, repo, labels) {
|
||||
async function doCheckInactive(owner, repo, labels) {
|
||||
const issues = await doQueryIssues(owner, repo, labels, issueState);
|
||||
|
||||
if (issues.length) {
|
||||
@@ -57,8 +49,8 @@ async function doCheckInactive (owner, repo, labels) {
|
||||
});
|
||||
if (!arr.includes(inactiveLabel)) {
|
||||
await doAddLabels(owner, repo, issues[i].number, inactiveLabel);
|
||||
if (core.getInput("body")) {
|
||||
await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
|
||||
if (core.getInput('body')) {
|
||||
await doCreateComment(owner, repo, issues[i].number, core.getInput('body'));
|
||||
}
|
||||
} else {
|
||||
core.info(`Actions: [add-inactive] issue ${issues[i].number} has label!`);
|
||||
@@ -67,19 +59,19 @@ async function doCheckInactive (owner, repo, labels) {
|
||||
} else {
|
||||
core.info(`Actions: [query-issues] empty!`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查 issue 是否满足条件,满足返回 true
|
||||
* 当前 issue 的指定人是否有一个满足 assigneeIncludes 里的某个
|
||||
* 关键字匹配,是否包含前一个某个+后一个某个 '官网,网站/挂了,无法访问'
|
||||
*/
|
||||
async function doCheckIssue (owner, repo, issueNumber) {
|
||||
async function doCheckIssue(owner, repo, issueNumber) {
|
||||
var checkResult = true;
|
||||
const issue = await octokit.issues.get({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
|
||||
if (!!checkResult && assigneeIncludes) {
|
||||
@@ -90,53 +82,51 @@ async function doCheckIssue (owner, repo, issueNumber) {
|
||||
checkResult = true;
|
||||
checkAssignee = true;
|
||||
}
|
||||
})
|
||||
!checkAssignee ? checkResult = false : null;
|
||||
});
|
||||
!checkAssignee ? (checkResult = false) : null;
|
||||
}
|
||||
|
||||
if (!!checkResult && titleIncludes) {
|
||||
const titleArr = titleIncludes.split('/');
|
||||
const keyword1 = dealStringToArr(titleArr[0]);
|
||||
const keyword2 = dealStringToArr(titleArr[1]);
|
||||
checkResult =
|
||||
keyword2.length ?
|
||||
matchKeyword(issue.data.title, keyword1) && matchKeyword(issue.data.title, keyword2) :
|
||||
matchKeyword(issue.data.title, keyword1);
|
||||
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 = dealStringToArr(bodyArr[0]);
|
||||
const keyword2 = dealStringToArr(bodyArr[1]);
|
||||
checkResult =
|
||||
keyword2.length ?
|
||||
matchKeyword(issue.data.body, keyword1) && matchKeyword(issue.data.body, keyword2) :
|
||||
matchKeyword(issue.data.body, keyword1);
|
||||
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);
|
||||
};
|
||||
core.setOutput('check-result', !!checkResult);
|
||||
}
|
||||
|
||||
async function doCloseIssues (owner, repo, labels) {
|
||||
async function doCloseIssues(owner, repo, labels) {
|
||||
const issues = await doQueryIssues(owner, repo, labels, 'open');
|
||||
|
||||
if (issues.length) {
|
||||
for (let i = 0; i < issues.length; i++) {
|
||||
await doCloseIssue(owner, repo, issues[i].number);
|
||||
if (core.getInput("body")) {
|
||||
await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
|
||||
if (core.getInput('body')) {
|
||||
await doCreateComment(owner, repo, issues[i].number, core.getInput('body'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
core.info(`Actions: [query-issues] empty!`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doFindComments (owner, repo, issueNumber) {
|
||||
async function doFindComments(owner, repo, issueNumber) {
|
||||
const res = await octokit.issues.listComments({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
core.info(`Actions: [find-comments][${issueNumber}] success!`);
|
||||
let comments = [];
|
||||
@@ -149,34 +139,35 @@ async function doFindComments (owner, repo, issueNumber) {
|
||||
auth: item.user.login,
|
||||
body: item.body,
|
||||
created: item.created_at,
|
||||
updated: item.updated_at
|
||||
})
|
||||
updated: item.updated_at,
|
||||
});
|
||||
if (direction === 'desc') {
|
||||
comments.reverse();
|
||||
}
|
||||
}
|
||||
})
|
||||
core.setOutput("comments", comments);
|
||||
};
|
||||
});
|
||||
core.setOutput('comments', comments);
|
||||
core.info(`out-comments: ${JSON.stringify(comments)}`);
|
||||
}
|
||||
|
||||
async function doLockIssues (owner, repo, labels) {
|
||||
async function doLockIssues(owner, repo, labels) {
|
||||
const issues = await doQueryIssues(owner, repo, labels, issueState);
|
||||
|
||||
if (issues.length) {
|
||||
for (let i = 0; i < issues.length; i++) {
|
||||
await doLockIssue(owner, repo, issues[i].number);
|
||||
if (core.getInput("body")) {
|
||||
await doCreateComment(owner, repo, issues[i].number, core.getInput("body"));
|
||||
if (core.getInput('body')) {
|
||||
await doCreateComment(owner, repo, issues[i].number, core.getInput('body'));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
core.info(`Actions: [query-issues] empty!`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doMonthStatistics (owner, repo, labels, assignees) {
|
||||
const countLables = core.getInput("count-lables");
|
||||
const countComments = core.getInput("count-comments");
|
||||
async function doMonthStatistics(owner, repo, labels, assignees) {
|
||||
const countLables = core.getInput('count-lables');
|
||||
const countComments = core.getInput('count-comments');
|
||||
|
||||
const thisMonth = dayjs.utc().month() + 1;
|
||||
const year = thisMonth == 1 ? dayjs.utc().year() - 1 : dayjs.utc().year();
|
||||
@@ -184,17 +175,13 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
|
||||
const month = getPreMonth(thisMonth);
|
||||
const showMonth = month < 10 ? `0${month}` : month;
|
||||
|
||||
let issues = await getIssuesInMonth(
|
||||
owner,
|
||||
repo,
|
||||
thisMonth
|
||||
);
|
||||
let issues = await getIssuesInMonth(owner, repo, thisMonth);
|
||||
if (issues.length == 0) {
|
||||
core.info(`Actions: [query-issues-${month}] empty!`);
|
||||
return false;
|
||||
}
|
||||
issues = issues.filter(i => {
|
||||
return getCreatedMonth(i.created_at) == month
|
||||
return getCreatedMonth(i.created_at) == month;
|
||||
});
|
||||
let total = issues.length;
|
||||
let totalIssues = [...issues];
|
||||
@@ -219,10 +206,12 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
|
||||
} else {
|
||||
labelsTotals[l.name] = 1;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
let now = dayjs().utc().format('YYYY-MM-DD HH:mm:ss');
|
||||
let now = dayjs()
|
||||
.utc()
|
||||
.format('YYYY-MM-DD HH:mm:ss');
|
||||
let body = `
|
||||
- Created time: ${now}
|
||||
|
||||
@@ -244,8 +233,8 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
|
||||
for (var lab in labelsTotals) {
|
||||
labelsArr.push({
|
||||
labelName: lab,
|
||||
number: labelsTotals[lab]
|
||||
})
|
||||
number: labelsTotals[lab],
|
||||
});
|
||||
}
|
||||
labelsArr.sort((a, b) => b.number - a.number);
|
||||
let labelsTitle = `
|
||||
@@ -255,12 +244,16 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Number</th>
|
||||
</tr>`
|
||||
</tr>`;
|
||||
let labelsBody = '';
|
||||
labelsArr.forEach(it => {
|
||||
labelsBody += `<tr><td>${it.labelName}</td><td>${it.number}</td></tr>`
|
||||
})
|
||||
body = body + labelsTitle + labelsBody + `</table>
|
||||
labelsBody += `<tr><td>${it.labelName}</td><td>${it.number}</td></tr>`;
|
||||
});
|
||||
body =
|
||||
body +
|
||||
labelsTitle +
|
||||
labelsBody +
|
||||
`</table>
|
||||
|
||||
`;
|
||||
}
|
||||
@@ -279,21 +272,21 @@ async function doMonthStatistics (owner, repo, labels, assignees) {
|
||||
<th>Number</th>
|
||||
<th>State</th>
|
||||
</tr>
|
||||
`
|
||||
`;
|
||||
let commentBody = '';
|
||||
maxComments.forEach((it,ind) => {
|
||||
maxComments.forEach((it, ind) => {
|
||||
commentBody += `<tr>
|
||||
<td>${ind + 1}</td>
|
||||
<td>${it.number}</td>
|
||||
<td>${it.title}</td>
|
||||
<td>${it.comments}</td>
|
||||
<td>${it.state}</td></tr>`
|
||||
})
|
||||
<td>${it.state}</td></tr>`;
|
||||
});
|
||||
body = body + commentTitle + commentBody + '</table>';
|
||||
}
|
||||
|
||||
await doCreateIssue(owner, repo, title, body, labels, assignees);
|
||||
};
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
module.exports = {
|
||||
|
381
src/base.js
381
src/base.js
@@ -1,28 +1,18 @@
|
||||
require('dotenv').config();
|
||||
const core = require("@actions/core");
|
||||
const github = require("@actions/github");
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
|
||||
// **************************************************************************
|
||||
const ALLREACTIONS = [
|
||||
"+1",
|
||||
"-1",
|
||||
"laugh",
|
||||
"confused",
|
||||
"heart",
|
||||
"hooray",
|
||||
"rocket",
|
||||
"eyes",
|
||||
];
|
||||
const ALLREACTIONS = ['+1', '-1', 'laugh', 'confused', 'heart', 'hooray', 'rocket', 'eyes'];
|
||||
|
||||
const {
|
||||
doQueryIssues
|
||||
} = require('./public.js');
|
||||
const { doQueryIssues } = require('./public.js');
|
||||
|
||||
const {
|
||||
dealStringToArr,
|
||||
dealRandomAssignees,
|
||||
testDuplicate,
|
||||
checkPermission,
|
||||
} = require('./util.js');
|
||||
|
||||
// **************************************************************************
|
||||
@@ -30,56 +20,56 @@ const token = core.getInput('token');
|
||||
const octokit = new Octokit({ auth: `token ${token}` });
|
||||
const context = github.context;
|
||||
|
||||
const contents = core.getInput("contents");
|
||||
const contents = core.getInput('contents');
|
||||
|
||||
const randomTo = core.getInput("random-to");
|
||||
const randomTo = core.getInput('random-to');
|
||||
|
||||
// **************************************************************************
|
||||
async function doAddAssignees (owner, repo, issueNumber, assignees) {
|
||||
async function doAddAssignees(owner, repo, issueNumber, assignees) {
|
||||
const arr = dealRandomAssignees(assignees, randomTo);
|
||||
await octokit.issues.addAssignees({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
assignees: arr
|
||||
assignees: arr,
|
||||
});
|
||||
core.info(`Actions: [add-assignees][${arr}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doAddLabels (owner, repo, issueNumber, labels) {
|
||||
async function doAddLabels(owner, repo, issueNumber, labels) {
|
||||
await octokit.issues.addLabels({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
labels: dealStringToArr(labels)
|
||||
labels: dealStringToArr(labels),
|
||||
});
|
||||
core.info(`Actions: [add-labels][${labels}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doCloseIssue (owner, repo, issueNumber) {
|
||||
async function doCloseIssue(owner, repo, issueNumber) {
|
||||
await octokit.issues.update({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
state: 'closed'
|
||||
state: 'closed',
|
||||
});
|
||||
core.info(`Actions: [close-issue][${issueNumber}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doCreateComment (owner, repo, issueNumber, body) {
|
||||
async function doCreateComment(owner, repo, issueNumber, body) {
|
||||
const { data } = await octokit.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
body
|
||||
body,
|
||||
});
|
||||
core.info(`Actions: [create-comment][${body}] success!`);
|
||||
core.setOutput("comment-id", data.id);
|
||||
core.setOutput('comment-id', data.id);
|
||||
|
||||
if (contents) {
|
||||
await doCreateCommentContent(owner, repo, data.id, dealStringToArr(contents));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doCreateCommentContent(owner, repo, commentId, contents) {
|
||||
if (contents.length) {
|
||||
@@ -89,15 +79,15 @@ async function doCreateCommentContent(owner, repo, commentId, contents) {
|
||||
owner,
|
||||
repo,
|
||||
comment_id: commentId,
|
||||
content: item
|
||||
content: item,
|
||||
});
|
||||
core.info(`Actions: [create-reactions][${item}] success!`);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doCreateIssue (owner, repo, title, body, labels, assignees) {
|
||||
async function doCreateIssue(owner, repo, title, body, labels, assignees) {
|
||||
let params = {
|
||||
owner,
|
||||
repo,
|
||||
@@ -109,12 +99,12 @@ async function doCreateIssue (owner, repo, title, body, labels, assignees) {
|
||||
|
||||
const { data } = await octokit.issues.create(params);
|
||||
core.info(`Actions: [create-issue][${title}] success!`);
|
||||
core.setOutput("issue-number", data.number);
|
||||
core.setOutput('issue-number', data.number);
|
||||
|
||||
if (contents) {
|
||||
await doCreateIssueContent(owner, repo, data.number, dealStringToArr(contents));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doCreateIssueContent(owner, repo, issueNumber, contents) {
|
||||
if (contents.length) {
|
||||
@@ -124,110 +114,182 @@ async function doCreateIssueContent(owner, repo, issueNumber, contents) {
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
content: item
|
||||
content: item,
|
||||
});
|
||||
core.info(`Actions: [create-reactions][${item}] success!`);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doDeleteComment (owner, repo, commentId) {
|
||||
await octokit.issues.deleteComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: commentId
|
||||
});
|
||||
core.info(`Actions: [delete-comment][${commentId}] success!`);
|
||||
};
|
||||
async function doCreateLabel(owner, repo) {
|
||||
const name = core.getInput('label-name');
|
||||
const color = core.getInput('label-color') || 'ededed';
|
||||
const description = core.getInput('label-desc') || '';
|
||||
|
||||
async function doLockIssue (owner, repo, issueNumber) {
|
||||
await octokit.issues.lock({
|
||||
if (!name) {
|
||||
core.setFailed(`This actions should input 'label-name'!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
await octokit.issues.createLabel({
|
||||
owner,
|
||||
repo,
|
||||
name,
|
||||
color,
|
||||
description,
|
||||
});
|
||||
core.info(`Actions: [create-label][${name}] success!`);
|
||||
} catch (err) {
|
||||
console.log(err.message);
|
||||
}
|
||||
}
|
||||
|
||||
async function doDeleteComment(owner, repo, commentId) {
|
||||
let id = commentId;
|
||||
|
||||
const outComments = core.getInput('out-comments');
|
||||
if (outComments) {
|
||||
const outCommentsArr = JSON.parse(outComments);
|
||||
core.info(`Actions: [out-comments-length][${outCommentsArr.length}] success!`);
|
||||
outCommentsArr.forEach(async item => {
|
||||
await doDelet(item.id);
|
||||
});
|
||||
} else {
|
||||
await doDelet(id);
|
||||
}
|
||||
|
||||
async function doDelet(id) {
|
||||
await octokit.issues.deleteComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: id,
|
||||
});
|
||||
core.info(`Actions: [delete-comment][${id}] success!`);
|
||||
}
|
||||
}
|
||||
|
||||
async function doLockIssue(owner, repo, issueNumber) {
|
||||
const lockReason = core.getInput('lock-reason');
|
||||
let params = {
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
};
|
||||
const reasons = ['off-topic', 'too heated', 'resolved', 'spam'];
|
||||
if (lockReason && reasons.includes(lockReason)) {
|
||||
params.lock_reason = lockReason;
|
||||
}
|
||||
await octokit.issues.lock(params);
|
||||
core.info(`Actions: [lock-issue][${issueNumber}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doMarkDuplicate (owner, repo, labels) {
|
||||
async function doMarkDuplicate(owner, repo, labels) {
|
||||
if (context.eventName != 'issue_comment') {
|
||||
core.info(`This actions only support on 'issue_comment'!`);
|
||||
return false;
|
||||
}
|
||||
if (context.payload.action != 'created') {
|
||||
core.info(`This actions only support on 'issue_comment' created!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const duplicateCommand = core.getInput("duplicate-command");
|
||||
const duplicateLabels = core.getInput("duplicate-labels");
|
||||
const removeLables = core.getInput("remove-labels");
|
||||
const closeIssue = core.getInput("close-issue");
|
||||
if (context.payload.action == 'created' || context.payload.action == 'edited') {
|
||||
const duplicateCommand = core.getInput('duplicate-command');
|
||||
const duplicateLabels = core.getInput('duplicate-labels');
|
||||
const removeLables = core.getInput('remove-labels');
|
||||
const closeIssue = core.getInput('close-issue');
|
||||
const requirePermission = core.getInput('require-permission') || 'write';
|
||||
|
||||
const commentId = context.payload.comment.id;
|
||||
const commentBody = context.payload.comment.body;
|
||||
const issueNumber = context.payload.issue.number;
|
||||
const commentId = context.payload.comment.id;
|
||||
const commentBody = context.payload.comment.body;
|
||||
const commentUser = context.payload.comment.user.login;
|
||||
const issueNumber = context.payload.issue.number;
|
||||
|
||||
const ifCommandInput = !!duplicateCommand;
|
||||
const ifCommandInput = !!duplicateCommand;
|
||||
|
||||
if ((ifCommandInput && commentBody.startsWith(duplicateCommand) && commentBody.split(' ')[0] == duplicateCommand) || testDuplicate(commentBody)) {
|
||||
if (ifCommandInput) {
|
||||
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
|
||||
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
|
||||
} else if (contents) {
|
||||
await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents));
|
||||
}
|
||||
if (
|
||||
!commentBody.includes('?') &&
|
||||
((ifCommandInput &&
|
||||
commentBody.startsWith(duplicateCommand) &&
|
||||
commentBody.split(' ')[0] == duplicateCommand) ||
|
||||
testDuplicate(commentBody))
|
||||
) {
|
||||
try {
|
||||
const res = await octokit.repos.getCollaboratorPermissionLevel({
|
||||
owner,
|
||||
repo,
|
||||
username: commentUser,
|
||||
});
|
||||
const { permission } = res.data;
|
||||
if (!checkPermission(requirePermission, permission)) {
|
||||
core.info(`The user ${commentUser} is not allow!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const issue = await octokit.issues.get({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber
|
||||
});
|
||||
let newLabels = [];
|
||||
if (issue.data.labels.length > 0) {
|
||||
newLabels = issue.data.labels.map(({ name }) => name).filter(name => !dealStringToArr(removeLables).includes(name));
|
||||
}
|
||||
if (duplicateLabels) {
|
||||
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
|
||||
}
|
||||
if (labels) {
|
||||
newLabels = dealStringToArr(labels);
|
||||
}
|
||||
if (newLabels.length > 0) {
|
||||
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
|
||||
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
|
||||
}
|
||||
if (ifCommandInput) {
|
||||
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
|
||||
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
|
||||
} else if (contents) {
|
||||
await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents));
|
||||
}
|
||||
|
||||
if (closeIssue == 'true') {
|
||||
await doCloseIssue(owner, repo, issueNumber);
|
||||
const issue = await octokit.issues.get({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
let newLabels = [];
|
||||
if (issue.data.labels.length > 0) {
|
||||
newLabels = issue.data.labels
|
||||
.map(({ name }) => name)
|
||||
.filter(name => !dealStringToArr(removeLables).includes(name));
|
||||
}
|
||||
if (duplicateLabels) {
|
||||
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
|
||||
}
|
||||
if (labels) {
|
||||
newLabels = dealStringToArr(labels);
|
||||
}
|
||||
if (newLabels.length > 0) {
|
||||
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
|
||||
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
|
||||
}
|
||||
|
||||
if (closeIssue == 'true') {
|
||||
await doCloseIssue(owner, repo, issueNumber);
|
||||
}
|
||||
} catch (error) {
|
||||
core.info(error.message);
|
||||
}
|
||||
} else {
|
||||
core.info(
|
||||
`This comment body should start whith 'duplicate-command' or 'Duplicate of' and not include '?'`,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
core.info(`This comment body should start whith 'duplicate-command'`);
|
||||
core.info(`This actions only support on 'issue_comment' created or edited!`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doOpenIssue (owner, repo, issueNumber) {
|
||||
async function doOpenIssue(owner, repo, issueNumber) {
|
||||
await octokit.issues.update({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
state: 'open'
|
||||
state: 'open',
|
||||
});
|
||||
core.info(`Actions: [open-issue][${issueNumber}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doRemoveAssignees (owner, repo, issueNumber, assignees) {
|
||||
async function doRemoveAssignees(owner, repo, issueNumber, assignees) {
|
||||
await octokit.issues.removeAssignees({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
assignees: dealStringToArr(assignees)
|
||||
assignees: dealStringToArr(assignees),
|
||||
});
|
||||
core.info(`Actions: [remove-assignees][${assignees}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doRemoveLabels (owner, repo, issueNumber, labels) {
|
||||
async function doRemoveLabels(owner, repo, issueNumber, labels) {
|
||||
const dealLabels = dealStringToArr(labels);
|
||||
for (label of dealLabels) {
|
||||
await octokit.issues.removeLabel({
|
||||
@@ -239,9 +301,9 @@ async function doRemoveLabels (owner, repo, issueNumber, labels) {
|
||||
core.info(`Actions: [remove-labels-foreach][${label}] success!`);
|
||||
}
|
||||
core.info(`Actions: [remove-labels][${labels}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doSetLabels (owner, repo, issueNumber, labels) {
|
||||
async function doSetLabels(owner, repo, issueNumber, labels) {
|
||||
// 概率性出现问题:https://github.com/octokit/rest.js/issues/1982,规避 setLabels
|
||||
if (labels) {
|
||||
// await octokit.issues.setLabels({
|
||||
@@ -253,7 +315,7 @@ async function doSetLabels (owner, repo, issueNumber, labels) {
|
||||
const issue = await octokit.issues.get({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
const baseLabels = issue.data.labels.map(({ name }) => name);
|
||||
const removeLabels = baseLabels.filter(name => !dealStringToArr(labels).includes(name));
|
||||
@@ -271,55 +333,63 @@ async function doSetLabels (owner, repo, issueNumber, labels) {
|
||||
|
||||
core.info(`Actions: [set-labels][${labels}] success!`);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doUnlockIssue (owner, repo, issueNumber) {
|
||||
async function doUnlockIssue(owner, repo, issueNumber) {
|
||||
await octokit.issues.unlock({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
core.info(`Actions: [unlock-issue][${issueNumber}] success!`);
|
||||
};
|
||||
}
|
||||
|
||||
async function doUpdateComment (
|
||||
owner,
|
||||
repo,
|
||||
commentId,
|
||||
body,
|
||||
updateMode,
|
||||
ifUpdateBody,
|
||||
) {
|
||||
const comment = await octokit.issues.getComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: commentId
|
||||
})
|
||||
const comment_body = comment.data.body;
|
||||
async function doUpdateComment(owner, repo, commentId, body, updateMode, ifUpdateBody) {
|
||||
let id = commentId;
|
||||
|
||||
let params = {
|
||||
owner,
|
||||
repo,
|
||||
comment_id: commentId
|
||||
};
|
||||
const outComments = core.getInput('out-comments');
|
||||
if (outComments) {
|
||||
const outCommentsArr = JSON.parse(outComments);
|
||||
core.info(`Actions: [out-comments-length][${outCommentsArr.length}] success!`);
|
||||
outCommentsArr.forEach(async item => {
|
||||
await doComment(item.id);
|
||||
});
|
||||
} else {
|
||||
await doComment(id);
|
||||
}
|
||||
|
||||
if (core.getInput("body") || ifUpdateBody) {
|
||||
if (updateMode === 'append') {
|
||||
params.body = `${comment_body}\n${body}`;
|
||||
} else {
|
||||
params.body = body;
|
||||
async function doComment(id) {
|
||||
const comment = await octokit.issues.getComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: id,
|
||||
});
|
||||
const comment_body = comment.data.body;
|
||||
|
||||
let params = {
|
||||
owner,
|
||||
repo,
|
||||
comment_id: id,
|
||||
};
|
||||
|
||||
if (core.getInput('body') || ifUpdateBody) {
|
||||
if (updateMode === 'append') {
|
||||
params.body = `${comment_body}\n${body}`;
|
||||
} else {
|
||||
params.body = body;
|
||||
}
|
||||
|
||||
await octokit.issues.updateComment(params);
|
||||
core.info(`Actions: [update-comment][${id}] success!`);
|
||||
}
|
||||
|
||||
await octokit.issues.updateComment(params);
|
||||
core.info(`Actions: [update-comment][${commentId}] success!`);
|
||||
if (contents) {
|
||||
await doCreateCommentContent(owner, repo, id, dealStringToArr(contents));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (contents) {
|
||||
await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents));
|
||||
}
|
||||
};
|
||||
|
||||
async function doUpdateIssue (
|
||||
async function doUpdateIssue(
|
||||
owner,
|
||||
repo,
|
||||
issueNumber,
|
||||
@@ -328,26 +398,26 @@ async function doUpdateIssue (
|
||||
body,
|
||||
updateMode,
|
||||
assignees,
|
||||
labels
|
||||
labels,
|
||||
) {
|
||||
const issue = await octokit.issues.get({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber
|
||||
})
|
||||
issue_number: issueNumber,
|
||||
});
|
||||
const issue_body = issue.data.body;
|
||||
const issue_title = issue.data.title;
|
||||
|
||||
let issue_labels = [];
|
||||
if (issue.data.labels.length > 0) {
|
||||
issue.data.labels.forEach(it =>{
|
||||
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.data.assignees.forEach(it => {
|
||||
issue_assignees.push(it.login);
|
||||
});
|
||||
}
|
||||
@@ -356,13 +426,13 @@ async function doUpdateIssue (
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issueNumber,
|
||||
state
|
||||
state,
|
||||
};
|
||||
|
||||
params.title = core.getInput("title") ? title : issue_title;
|
||||
params.title = core.getInput('title') ? title : issue_title;
|
||||
|
||||
let next_body;
|
||||
if (core.getInput("body")) {
|
||||
if (core.getInput('body')) {
|
||||
if (updateMode === 'append') {
|
||||
next_body = `${issue_body}\n${body}`;
|
||||
} else {
|
||||
@@ -382,21 +452,21 @@ async function doUpdateIssue (
|
||||
if (contents) {
|
||||
await doCreateIssueContent(owner, repo, issueNumber, contents);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function doWelcome (owner, repo, assignees, labels, body) {
|
||||
async function doWelcome(owner, repo, assignees, labels, body) {
|
||||
const context = github.context;
|
||||
const isIssue = !!context.payload.issue;
|
||||
const issueContents = core.getInput("issue-contents");
|
||||
const issueContents = core.getInput('issue-contents');
|
||||
if (!isIssue) {
|
||||
core.setFailed("The event that triggered this action must be a issue. Error!");
|
||||
core.setFailed('The event that triggered this action must be a issue. Error!');
|
||||
} else {
|
||||
const auth = context.payload.sender.login;
|
||||
core.info(`Actions: [welcome: auth=][${auth}]`);
|
||||
const issueNumber = context.issue.number;
|
||||
const issues = await doQueryIssues(owner, repo, false, 'all', auth);
|
||||
if (issues.length == 0 || (issues.length == 1 && issues[0].number == issueNumber)) {
|
||||
if (core.getInput("body")) {
|
||||
if (core.getInput('body')) {
|
||||
await doCreateComment(owner, repo, issueNumber, body);
|
||||
} else {
|
||||
core.info(`Actions: [welcome] no body!`);
|
||||
@@ -417,17 +487,17 @@ async function doWelcome (owner, repo, assignees, labels, body) {
|
||||
core.info(`Actions: [welcome][${auth}] is not first time!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
function testContent(con) {
|
||||
if (ALLREACTIONS.includes(con)) {
|
||||
return true;
|
||||
} else {
|
||||
core.setFailed("This actions not supported!");
|
||||
core.setFailed('This actions not supported!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
module.exports = {
|
||||
@@ -438,6 +508,7 @@ module.exports = {
|
||||
doCreateCommentContent,
|
||||
doCreateIssue,
|
||||
doCreateIssueContent,
|
||||
doCreateLabel,
|
||||
doDeleteComment,
|
||||
doMarkDuplicate,
|
||||
doLockIssue,
|
||||
|
@@ -104,3 +104,9 @@
|
||||
background: #fafafa;
|
||||
}
|
||||
}
|
||||
|
||||
.__dumi-default-alert {
|
||||
box-shadow: 0 6px 16px 2px rgba(0,0,0,.06) !important;
|
||||
border-radius: 2px !important;
|
||||
border: 1px solid #0000000f;
|
||||
}
|
||||
|
89
src/main.js
89
src/main.js
@@ -1,5 +1,5 @@
|
||||
const core = require("@actions/core");
|
||||
const github = require("@actions/github");
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
|
||||
// **************************************************************************
|
||||
const {
|
||||
@@ -8,6 +8,7 @@ const {
|
||||
doCloseIssue,
|
||||
doCreateComment,
|
||||
doCreateIssue,
|
||||
doCreateLabel,
|
||||
doDeleteComment,
|
||||
doMarkDuplicate,
|
||||
doLockIssue,
|
||||
@@ -38,6 +39,7 @@ const ALLACTIONS = [
|
||||
'close-issue',
|
||||
'create-comment',
|
||||
'create-issue',
|
||||
'create-label',
|
||||
'delete-comment',
|
||||
'lock-issue',
|
||||
'mark-duplicate',
|
||||
@@ -68,24 +70,24 @@ async function main() {
|
||||
const issueNumber = core.getInput('issue-number');
|
||||
const commentId = core.getInput('comment-id');
|
||||
|
||||
const defaultBody = `Currently at ${owner}/${repo}. And this is default comment.`
|
||||
const body = core.getInput("body") || defaultBody;
|
||||
const defaultBody = `Currently at ${owner}/${repo}. And this is default comment.`;
|
||||
const body = core.getInput('body') || defaultBody;
|
||||
|
||||
const defaultTitle = `Default Title`;
|
||||
const title = core.getInput("title") || defaultTitle;
|
||||
const title = core.getInput('title') || defaultTitle;
|
||||
|
||||
const assignees = core.getInput("assignees");
|
||||
const assignees = core.getInput('assignees');
|
||||
|
||||
const labels = core.getInput("labels");
|
||||
const state = core.getInput("state") || 'open';
|
||||
const labels = core.getInput('labels');
|
||||
const state = core.getInput('state') || 'open';
|
||||
|
||||
let updateMode = core.getInput("update-mode");
|
||||
let updateMode = core.getInput('update-mode');
|
||||
if (updateMode !== 'append') {
|
||||
updateMode = 'replace';
|
||||
}
|
||||
|
||||
// actions
|
||||
const actions = core.getInput("actions", { required: true });
|
||||
const actions = core.getInput('actions', { required: true });
|
||||
|
||||
const actionsArr = actions.split(',');
|
||||
actionsArr.forEach(item => {
|
||||
@@ -96,9 +98,9 @@ async function main() {
|
||||
if (ALLACTIONS.includes(action)) {
|
||||
choseActions(action);
|
||||
} else {
|
||||
core.setFailed("This actions not supported!");
|
||||
core.setFailed('This actions not supported!');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async function choseActions(action) {
|
||||
switch (action) {
|
||||
@@ -118,6 +120,9 @@ async function main() {
|
||||
case 'create-issue':
|
||||
await doCreateIssue(owner, repo, title, body, labels, assignees);
|
||||
break;
|
||||
case 'create-label':
|
||||
await doCreateLabel(owner, repo);
|
||||
break;
|
||||
case 'delete-comment':
|
||||
await doDeleteComment(owner, repo, commentId);
|
||||
break;
|
||||
@@ -143,13 +148,7 @@ async function main() {
|
||||
await doUnlockIssue(owner, repo, issueNumber);
|
||||
break;
|
||||
case 'update-comment':
|
||||
await doUpdateComment(
|
||||
owner,
|
||||
repo,
|
||||
commentId,
|
||||
body,
|
||||
updateMode
|
||||
);
|
||||
await doUpdateComment(owner, repo, commentId, body, updateMode);
|
||||
break;
|
||||
case 'update-issue':
|
||||
await doUpdateIssue(
|
||||
@@ -161,70 +160,38 @@ async function main() {
|
||||
body,
|
||||
updateMode,
|
||||
assignees,
|
||||
labels
|
||||
labels,
|
||||
);
|
||||
break;
|
||||
case 'welcome':
|
||||
await doWelcome(
|
||||
owner,
|
||||
repo,
|
||||
assignees,
|
||||
labels,
|
||||
body
|
||||
);
|
||||
await doWelcome(owner, repo, assignees, labels, body);
|
||||
break;
|
||||
|
||||
// advanced
|
||||
case 'check-inactive':
|
||||
await doCheckInactive(
|
||||
owner,
|
||||
repo,
|
||||
labels
|
||||
)
|
||||
await doCheckInactive(owner, repo, labels);
|
||||
break;
|
||||
case 'check-issue':
|
||||
await doCheckIssue(
|
||||
owner,
|
||||
repo,
|
||||
issueNumber
|
||||
);
|
||||
await doCheckIssue(owner, repo, issueNumber);
|
||||
break;
|
||||
case 'close-issues':
|
||||
await doCloseIssues(
|
||||
owner,
|
||||
repo,
|
||||
labels
|
||||
)
|
||||
await doCloseIssues(owner, repo, labels);
|
||||
break;
|
||||
case 'find-comments':
|
||||
await doFindComments(
|
||||
owner,
|
||||
repo,
|
||||
issueNumber
|
||||
);
|
||||
await doFindComments(owner, repo, issueNumber);
|
||||
break;
|
||||
case 'lock-issues':
|
||||
await doLockIssues(
|
||||
owner,
|
||||
repo,
|
||||
labels
|
||||
);
|
||||
await doLockIssues(owner, repo, labels);
|
||||
break;
|
||||
case 'month-statistics':
|
||||
await doMonthStatistics(
|
||||
owner,
|
||||
repo,
|
||||
labels,
|
||||
assignees
|
||||
);
|
||||
await doMonthStatistics(owner, repo, labels, assignees);
|
||||
break;
|
||||
// default
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,8 @@
|
||||
require('dotenv').config();
|
||||
const core = require("@actions/core");
|
||||
const core = require('@actions/core');
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
|
||||
const {
|
||||
getPreMonth
|
||||
} = require('./util.js');
|
||||
const { getPreMonth } = require('./util.js');
|
||||
|
||||
// **************************************************************************
|
||||
var dayjs = require('dayjs');
|
||||
@@ -19,26 +17,26 @@ const octokit = new Octokit({ auth: `token ${token}` });
|
||||
|
||||
const perPage = 100;
|
||||
|
||||
const issueCreator = core.getInput("issue-creator");
|
||||
const issueCreator = core.getInput('issue-creator');
|
||||
const issueAssignee = core.getInput('issue-assignee');
|
||||
const issueMentioned = core.getInput('issue-mentioned');
|
||||
|
||||
const bodyIncludes = core.getInput('body-includes');
|
||||
const titleIncludes = core.getInput('title-includes');
|
||||
|
||||
const inactiveDay = core.getInput("inactive-day");
|
||||
const inactiveDay = core.getInput('inactive-day');
|
||||
|
||||
// **************************************************************************
|
||||
async function doQueryIssues (owner, repo, labels, state, creator) {
|
||||
async function doQueryIssues(owner, repo, labels, state, creator) {
|
||||
let params = {
|
||||
owner,
|
||||
repo,
|
||||
state,
|
||||
};
|
||||
|
||||
issueCreator ? params.creator = issueCreator : null;
|
||||
issueAssignee ? params.assignee = issueAssignee : null;
|
||||
issueMentioned ? params.mentioned = issueMentioned : null;
|
||||
issueCreator ? (params.creator = issueCreator) : null;
|
||||
issueAssignee ? (params.assignee = issueAssignee) : null;
|
||||
issueMentioned ? (params.mentioned = issueMentioned) : null;
|
||||
|
||||
if (labels) {
|
||||
params.labels = labels;
|
||||
@@ -73,47 +71,51 @@ async function doQueryIssues (owner, repo, labels, state, creator) {
|
||||
issueNumbers.push(iss.number);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
core.info(`Actions: [query-issues]: [${JSON.stringify(issueNumbers)}]!`);
|
||||
}
|
||||
|
||||
return issues;
|
||||
};
|
||||
}
|
||||
|
||||
async function getIssues (params, page = 1) {
|
||||
async function getIssues(params, page = 1) {
|
||||
let { data: issues } = await octokit.issues.listForRepo({
|
||||
...params,
|
||||
per_page: perPage,
|
||||
page
|
||||
page,
|
||||
});
|
||||
if (issues.length >= perPage) {
|
||||
issues = issues.concat(await getIssues(params, page + 1));
|
||||
}
|
||||
return issues;
|
||||
};
|
||||
}
|
||||
|
||||
async function getIssuesInMonth (owner, repo, thisMonth, page = 1) {
|
||||
async function getIssuesInMonth(owner, repo, thisMonth, page = 1) {
|
||||
const month = getPreMonth(thisMonth);
|
||||
let { data: issues } = await octokit.issues.listForRepo({
|
||||
owner,
|
||||
repo,
|
||||
state: 'all',
|
||||
per_page: perPage,
|
||||
page
|
||||
page,
|
||||
});
|
||||
issues = issues.filter(i => {
|
||||
return i.pull_request === undefined
|
||||
return i.pull_request === undefined;
|
||||
});
|
||||
if (issues.length && getCreatedMonth(issues[issues.length - 1].created_at) >= month) {
|
||||
issues = issues.concat(await getIssuesInMonth(owner, repo, thisMonth, page + 1));
|
||||
}
|
||||
return issues;
|
||||
};
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
function getCreatedMonth (d) {
|
||||
return dayjs(d).utc().month() + 1;
|
||||
};
|
||||
function getCreatedMonth(d) {
|
||||
return (
|
||||
dayjs(d)
|
||||
.utc()
|
||||
.month() + 1
|
||||
);
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
module.exports = {
|
||||
|
43
src/util.js
43
src/util.js
@@ -1,6 +1,6 @@
|
||||
const sampleSize = require('lodash/sampleSize');
|
||||
const sampleSize = require('lodash/sampleSize');
|
||||
|
||||
function dealStringToArr (para) {
|
||||
function dealStringToArr(para) {
|
||||
/**
|
||||
* in 'x1,x2,x3'
|
||||
* out ['x1','x2','x3']
|
||||
@@ -9,29 +9,29 @@ function dealStringToArr (para) {
|
||||
if (para) {
|
||||
const paraArr = para.split(',');
|
||||
paraArr.forEach(it => {
|
||||
if(it.trim()){
|
||||
arr.push(it.trim())
|
||||
if (it.trim()) {
|
||||
arr.push(it.trim());
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
}
|
||||
|
||||
function dealRandomAssignees (assignees, randomTo) {
|
||||
function dealRandomAssignees(assignees, randomTo) {
|
||||
let arr = dealStringToArr(assignees);
|
||||
if (randomTo && Number(randomTo) > 0 && Number(randomTo) < arr.length) {
|
||||
arr = sampleSize(arr, randomTo);
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
}
|
||||
|
||||
function matchKeyword (content, keywords) {
|
||||
function matchKeyword(content, keywords) {
|
||||
return keywords.find(item => content.toLowerCase().includes(item));
|
||||
};
|
||||
}
|
||||
|
||||
function testDuplicate(body) {
|
||||
if (!body || !body.startsWith('Duplicate of')) {
|
||||
return false
|
||||
return false;
|
||||
}
|
||||
|
||||
let arr = body.split(' ');
|
||||
@@ -40,16 +40,29 @@ function testDuplicate(body) {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getPreMonth (m) {
|
||||
return m == 1 ? 12 : m -1;
|
||||
};
|
||||
function getPreMonth(m) {
|
||||
return m == 1 ? 12 : m - 1;
|
||||
}
|
||||
|
||||
function checkPermission(require, permission) {
|
||||
/**
|
||||
* 有权限返回 true
|
||||
*/
|
||||
const permissions = ['none', 'read', 'write', 'admin'];
|
||||
const requireNo = permissions.indexOf(require);
|
||||
const permissionNo = permissions.indexOf(permission);
|
||||
|
||||
return requireNo <= permissionNo;
|
||||
}
|
||||
|
||||
// **********************************************************
|
||||
module.exports = {
|
||||
dealStringToArr,
|
||||
dealRandomAssignees,
|
||||
getPreMonth,
|
||||
matchKeyword,
|
||||
testDuplicate,
|
||||
checkPermission,
|
||||
};
|
||||
|
Reference in New Issue
Block a user