From edaa57fd7b4574d1f4f1257999bf127e33fcfcde Mon Sep 17 00:00:00 2001 From: Kirill Sizov Date: Tue, 5 Jul 2022 13:08:07 +0300 Subject: [PATCH] Fix comment workflow (#103) --- .github/workflows/comment.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml index 91aa7f0c..11fe19b0 100644 --- a/.github/workflows/comment.yml +++ b/.github/workflows/comment.yml @@ -21,13 +21,15 @@ jobs: - name: Check author of comment id: check-author run: | - COLLABORATOR=$(gh api repos/${{ github.repository }}/collaborators | jq ".[] | select((.login == \"${{ github.event.comment.user.login }}\"))") - - echo Author of comment: ${COLLABORATOR} - echo ::set-output name=collaborator::${COLLABORATOR} + PERM=$(gh api repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission | jq -r '.permission') + if [[ $PERM == "write" || $PERM == "maintain" || $PERM == "admin" ]]; + then + ALLOW="true" + fi + echo ::set-output name=allow::${ALLOW} - name: Verify that author of comment is collaborator - if: steps.check-author.outputs.collaborator == '' + if: steps.check-author.outputs.allow == '' uses: actions/github-script@v3 with: script: |