From 303b6cc17b72ee46637a5ceec1d54ee32419887f Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Sat, 8 Jun 2024 22:50:33 +0200 Subject: [PATCH] Skipping whole wf if pr author is not accepted --- .github/workflows/lagoon.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lagoon.yml b/.github/workflows/lagoon.yml index 93ce99876..9adcb099a 100644 --- a/.github/workflows/lagoon.yml +++ b/.github/workflows/lagoon.yml @@ -23,8 +23,13 @@ jobs: steps: - name: Check PR author run: | - echo "PR Author accepted. Continuing..." - if: ${{ vars.IGNORED_PR_AUTHORS && env.AUTHOR_IS_IGNORED == 'false' }} + set -e + if [[ "${{ env.AUTHOR_IS_IGNORED }}" == "true" ]] + then + echo "${{ format('PR author {0} is not allowed to create Lagoon environments. Skipping deployment...', env.PR_AUTHOR) }}" + exit 1 + fi + if: ${{ vars.IGNORED_PR_AUTHORS }} env: AUTHOR_IS_IGNORED: $(echo '${{ vars.IGNORED_PR_AUTHORS }}' | jq --arg author "${{ github.event.pull_request.user.login }}" 'any(.[]; . as $user | $author | match($user))')