Skip to content

Commit

Permalink
feat: add review-creator
Browse files Browse the repository at this point in the history
  • Loading branch information
xrkffgg committed Sep 15, 2021
1 parent 79a577f commit 59a5d1e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.3.0

`2021.09.15`

- feat: add `review-creator`.

## v1.2.0

`2021.09.13`
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
你好~
emoji: '+1, -1, heart'
reviewers: 'user1, user2'
review-creator: false
close: true
```
Expand All @@ -43,6 +44,7 @@ jobs:
| pr-emoji | Add emoji to PR | string | ✖ |
| close | If close pr | boolean | ✖ |
| reviewers | Add reviewers to PR | string | ✖ |
| review-creator | If creator review. Default `true` | boolean | ✖ |

## Note

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ inputs:
description: If refuse close
reviewers:
description: Add description to PR
review-creator:
description: If add creator review

runs:
using: 'node12'
Expand Down
6 changes: 5 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7503,6 +7503,7 @@ async function run() {
const PRemoji = core.getInput('pr-emoji');
const close = core.getInput('close');
const reviewersString = core.getInput('reviewers');
const reviewCreator = core.getInput('review-creator') || 'true';

let result = true;

Expand Down Expand Up @@ -7610,7 +7611,10 @@ async function run() {
}

if (reviewersString) {
const reviewers = dealStringToArr(reviewersString);
let reviewers = dealStringToArr(reviewersString);
if (reviewCreator === 'false') {
reviewers = reviewers.filter(o => o !== creator);
}
await octokit.pulls.requestReviewers({
owner,
repo,
Expand Down
6 changes: 5 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async function run() {
const PRemoji = core.getInput('pr-emoji');
const close = core.getInput('close');
const reviewersString = core.getInput('reviewers');
const reviewCreator = core.getInput('review-creator') || 'true';

let result = true;

Expand Down Expand Up @@ -137,7 +138,10 @@ async function run() {
}

if (reviewersString) {
const reviewers = dealStringToArr(reviewersString);
let reviewers = dealStringToArr(reviewersString);
if (reviewCreator === 'false') {
reviewers = reviewers.filter(o => o !== creator);
}
await octokit.pulls.requestReviewers({
owner,
repo,
Expand Down

0 comments on commit 59a5d1e

Please sign in to comment.