From e7a79fb4658c0f0a89640404e3319fe038c6a1de Mon Sep 17 00:00:00 2001 From: Ugo Palatucci Date: Mon, 14 Feb 2022 15:02:56 +0100 Subject: [PATCH] auto-add-reviewers --- .github/workflows/main.yml | 2 +- README.md | 7 ++++--- action.yml | 2 +- index.js | 7 +++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0750471..dc0dd7c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }}" diff --git a/README.md b/README.md index 52c5ce4..1c51d93 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/action.yml b/action.yml index e0d9e8b..e15912a 100644 --- a/action.yml +++ b/action.yml @@ -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 diff --git a/index.js b/index.js index 61d9580..3d26c30 100644 --- a/index.js +++ b/index.js @@ -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); @@ -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); } }