Skip to content

Commit

Permalink
Require required approvers list
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Dec 6, 2023
1 parent c5b2e81 commit abfb90e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
- if: steps.approved-by-required-users.outcome != 'failure' || steps.approved-by-required-users.outputs.maintainer-approvals != 'peternied'
run: echo "Unexpected outcome:${{ steps.approved-by-required-users.outcome }} or maintainer-approvals:${{steps.approved-by-required-users.outputs.maintainer-approvals}}"

test-approved-by-anyone:
test-no-required-approvers-list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -124,5 +124,5 @@ jobs:
mock-approvers: 'peternied bob kelly'
mock-pr-number: 42

- if: steps.approved-by-required-users.outcome != 'failure' || steps.approved-by-required-users.outputs.maintainer-approvals != 'peternied bob kelly'
- if: steps.approved-by-required-users.outcome != 'success' || steps.approved-by-required-users.outputs.maintainer-approvals != 'peternied bob kelly'
run: echo "Unexpected outcome:${{ steps.approved-by-required-users.outcome }} or maintainer-approvals:${{steps.approved-by-required-users.outputs.maintainer-approvals}}"
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
required: true
required-approvers-list:
description: 'The list of specific users that can approve the request, comma seperated. '
required: false
required: true
min-required:
description: 'The minimum number of approvals, e.g. 2'
required: true
Expand All @@ -24,9 +24,6 @@ outputs:
```yaml
on:
pull_request_review:
types: [approved]
pull_request_target:
types: [opened, reopened]
...
steps:
- id: list-maintainers
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
required: true
required-approvers-list:
description: 'The list of specific users that can approve the request, comma separated. '
required: false
required: true
min-required:
description: 'The minimum number of approvals, e.g. 2'
required: true
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36730,7 +36730,7 @@ async function run() {
return;
}

const requiredApprovers = core.getInput('required-approvers-list', { required: false })?.split(',').map(s => s.trim()) || [];
const requiredApprovers = core.getInput('required-approvers-list', { required: true })?.split(',').map(s => s.trim()).filter(a => a.length != 0);
const mockApprovers = core.getInput('mock-approvers', { required: false })?.split(' ') || [];

let pullRequestApprovers = mockApprovers;
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function run() {
return;
}

const requiredApprovers = core.getInput('required-approvers-list', { required: false })?.split(',').map(s => s.trim()) || [];
const requiredApprovers = core.getInput('required-approvers-list', { required: true })?.split(',').map(s => s.trim()).filter(a => a.length != 0);
const mockApprovers = core.getInput('mock-approvers', { required: false })?.split(' ') || [];

let pullRequestApprovers = mockApprovers;
Expand Down

0 comments on commit abfb90e

Please sign in to comment.