From eb0534047e9adfb5b779556edeed7504a8908227 Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Tue, 17 Oct 2023 09:52:34 -0500 Subject: [PATCH] Add strange spacing test Signed-off-by: Peter Nied --- .github/workflows/test.yml | 19 ++++++++++++++++++- README.md | 4 ++-- action.yml | 4 ++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e7c5c1..766705c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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}}" \ No newline at end of file diff --git a/README.md b/README.md index f20c7a8..0537e3e 100644 --- a/README.md +++ b/README.md @@ -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' @@ -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: diff --git a/action.yml b/action.yml index 5877640..5eba2ab 100644 --- a/action.yml +++ b/action.yml @@ -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' @@ -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