From 7876483fe4e93eb70aa3104693ac63f1f5355b30 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Fri, 7 Jun 2024 22:59:55 +0200 Subject: [PATCH 1/2] Mikkel tester From 21f10fdf852ed857e64f84a1a1c9ec06a86b7d65 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Sat, 8 Jun 2024 17:22:02 +0200 Subject: [PATCH 2/2] Trying to add pr uathor check in lagoon wf --- .github/workflows/lagoon.yml | 22 ++++++++++++++++++++++ .github/workflows/miktest.yml | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lagoon.yml b/.github/workflows/lagoon.yml index f1299df7e..d5866e176 100644 --- a/.github/workflows/lagoon.yml +++ b/.github/workflows/lagoon.yml @@ -17,9 +17,31 @@ env: LAGOON_PROJECT: "dpl-cms" jobs: + CheckPrAuthor: + name: Check PR author + runs-on: ubuntu-latest + steps: + - name: Check PR author + run: | + set -e + echo "IGNORED_PR_AUTHORS: ${{ vars.IGNORED_PR_AUTHORS }}" + echo "PR author: ${{ github.event.pull_request.user.login }}" + + AUTHOR_IS_IGNORED=$(echo '${{ vars.IGNORED_PR_AUTHORS }}' | jq --arg author "${{ github.event.pull_request.user.login }}" 'any(.[]; . as $ | $author | match($))') + + echo "PR author is ${{ github.event.pull_request.user.login }}" + exit 1 + if [[ "${{ github.event.pull_request.user.login }}" == "dpl-bot" ]] + then + echo "PR author is dpl-bot. Skipping deployment." + exit 1 + fi + if: ${{ vars.IGNORED_PR_AUTHORS }} + BranchNameLength: name: Check branch length runs-on: ubuntu-latest + needs: [CheckPrAuthor] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/miktest.yml b/.github/workflows/miktest.yml index d5f2b36db..dc9385a99 100644 --- a/.github/workflows/miktest.yml +++ b/.github/workflows/miktest.yml @@ -5,4 +5,4 @@ jobs: runs-on: ubuntu-latest steps: - name: mik debug - run: echo ${{ toJson(github.event.pull_request.owner) }}" + run: echo ${{ toJson(github.event.pull_request) }}"