Skip to content

Commit

Permalink
auto-add-reviewers
Browse files Browse the repository at this point in the history
  • Loading branch information
upalatucci committed Feb 14, 2022
1 parent d778314 commit e7a79fb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
with:
owners-path: './test/OWNERS'
n-random-reviewers: 2
auto-add: true
auto-add-reviewers: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get approvers
run: echo "The Approvers are ${{ steps.owners.outputs.approvers }}"
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
with:
owners-path: './test/OWNERS'
n-random-reviewers: 2
auto-add: true
auto-add-reviewers: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get approvers
run: echo "The Approvers are ${{ steps.owners.outputs.approvers }}"
- name: Get reviewers
Expand All @@ -41,8 +42,8 @@ You can set any or all of the following input parameters:
|-------------------------|--------|----------|----------------------------|------------------------------------
|`owners-path` |string |no |OWNERS |OWNERS file path including the actual file name
|`n-random-reviewers` |number |no | |If you want, the action can expose also random reviewers
|`auto-add` |boolean |no |false |Should add the random reviewers to pr automatically. Ignored if pr not found
|`token` |string |no | |Secret Token to add Reviewers
|`auto-add-reviewers` |boolean |no |false |Should add the random reviewers to pr automatically. Ignored if pr not found
|`token` |string |no | |Secret Token to add Reviewers ( could also be povided into the env )


Output Variables
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
n-random-reviewers:
description: 'Number of random reviewers you want to generate'
required: false
auto-add:
auto-add-reviewers:
description: 'Should add the random reviewers to pr automatically. Ignored if pr not found'
required: false
default: false
Expand Down
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function addReviewers(context, reviewers) {
try {
const repoOwnersPath = core.getInput("owners-path");
const numberReviewers = core.getInput("n-random-reviewers");
const autoAdd = core.getInput("auto-add");
const autoAddReviewers = core.getInput("auto-add-reviewers");

console.log("OWNERS FILE", repoOwnersPath);

Expand All @@ -74,7 +74,10 @@ try {
numberReviewers
);

if (autoAdd && context.payload.pull_request?.number !== undefined) {
if (
autoAddReviewers &&
context.payload.pull_request?.number !== undefined
) {
addReviewers(context, selectedReviewers);
}
}
Expand Down

0 comments on commit e7a79fb

Please sign in to comment.