Skip to content

Commit

Permalink
Add strange spacing test
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Oct 17, 2023
1 parent 9a369be commit eb05340
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,26 @@ jobs:
uses: ./ # Use the action
with:
token: ${{ secrets.GITHUB_TOKEN }}
maintainers: 'peternied greengiant'
maintainers: 'peternied, greengiant'
min-required: 2
mock-approvers: 'peternied'

- if: steps.approved-by-maintainers.outcome != 'failure' || steps.approved-by-maintainers.outputs.maintainer-approvals != 'peternied'
run: echo "Unexpected outcome:${{ steps.approved-by-maintainers.outcome }} or maintainer-approvals:${{steps.approved-by-maintainers.outputs.maintainer-approvals}}"

test-approvers-match-strange-maintainers-spacing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- id: approved-by-maintainers
continue-on-error: true
uses: ./ # Use the action
with:
token: ${{ secrets.GITHUB_TOKEN }}
maintainers: 'peternied, greengiant, austin, billyjean robert'
min-required: 4
mock-approvers: 'peternied greengiant austin billyjean robert'

- if: steps.approved-by-maintainers.outcome != 'failure' || steps.approved-by-maintainers.outputs.maintainer-approvals != 'peternied'
run: echo "Unexpected outcome:${{ steps.approved-by-maintainers.outcome }} or maintainer-approvals:${{steps.approved-by-maintainers.outputs.maintainer-approvals}}"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
description: "GitHub token used for authentication"
required: true
maintainers:
description: 'The list of maintainers that can approve the request, space seperated'
description: 'The list of maintainers that can approve the request, comma seperated'
required: false
min-required:
description: 'The minimum number of maintainers required to approve, e.g. 2'
Expand All @@ -25,7 +25,7 @@ on:
...
steps:
- id: find-maintainers
run: echo "maintainers=$(cat C:/Users/peter/Documents/GitHub/OpenSearch/MAINTAINERS.md | grep -oP '(?<=\[).+(?=\]\(http)' | tr '\n' ' ')" >> $GITHUB_ENV
run: echo "maintainers='danny, ricky, bobby'" >> $GITHUB_ENV

- uses: peternied/approved-by-maintainers@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
description: "GitHub token used for authentication"
required: true
maintainers:
description: 'The list of maintainers that can approve the request, space seperated'
description: 'The list of maintainers that can approve the request, comma seperated'
required: false
min-required:
description: 'The minimum number of maintainers required to approve, e.g. 2'
Expand Down Expand Up @@ -39,7 +39,7 @@ runs:

- run: |
declare -i approvals_count=0
maintainers_padded=" ${{ inputs.maintainers }} " # Padding before and after for substring safety check below
maintainers_padded=" $(echo ${{ inputs.maintainers }} | tr ',' ' ' | sed s/ \+/ /g) " # Padding before and after for substring safety check below
maintainer_approvals=""
for user in $approvers; do
# Match with strings padding the username on both sides to avoid substring matches
Expand Down

0 comments on commit eb05340

Please sign in to comment.