From 1ddd5807fb633e0dfc420879dfa6b2707cd19ccc Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Tue, 21 May 2024 19:45:58 +0200 Subject: [PATCH] Testing... --- .github/workflows/create-pr.yml | 11 ++++++++++- .github/workflows/test.yml | 17 +++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create-pr.yml b/.github/workflows/create-pr.yml index 869089c753..064a3cdd81 100644 --- a/.github/workflows/create-pr.yml +++ b/.github/workflows/create-pr.yml @@ -33,6 +33,15 @@ jobs: fetch-depth: 0 if: ${{ env.PR_BRANCH && env.BUILD_URL }} + - name: Check if branch exists already + run: | + echo "BRANCH_EXISTS=$(git show-ref --quiet refs/heads/${{ env.PR_BRANCH }} && echo 'true' || echo 'false')" >> $GITHUB_ENV + if: ${{ env.PR_BRANCH }} + + - name : machine echo env + env : { CONTENT : "${{ toJson(env) }}" } + run : "echo $CONTENT" + - name: Insert dependency uses: Wandalen/wretry.action@master id: manipulate_composer @@ -43,7 +52,7 @@ jobs: composer remove ${{ env.PACKAGE }} \ && composer require ${{ env.PACKAGE }} attempt_limit: 200 - if: ${{ env.BUILD_URL && env.PACKAGE && env.BUILD_URL_IS_ACCEPTED == 'true' }} + if: ${{ env.BRANCH_EXISTS == 'false' && env.BUILD_URL && env.PACKAGE && env.BUILD_URL_IS_ACCEPTED == 'true' }} - name: Create branch and PR id: create_pr diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62ed577898..c0ef469118 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,12 +11,13 @@ jobs: name: Test runs-on: ubuntu-latest steps: + - id: check-branch-exists + uses: GuillaumeFalourd/branch-exists@v1 + with: + branch: humourless-satisfactory-copperbutterfly - - name: Testing - run: | - BRANCH_EXISTS=$(git fetch origin develop || echo "John") - echo "$BRANCH_EXISTS" - # echo "BUILD_URL_IS_ACCEPTED=$BUILD_URL_IS_ACCEPTED" >> $GITHUB_ENV - - name: Testing II - run: | - echo "Hello" + - if: steps.check-branch-exists.outputs.exists == 'true' + run: echo 'humourless-satisfactory-copperbutterfly Branch exists' + + - if: steps.check-branch-exists.outputs.exists == 'false' + run: echo 'humourless-satisfactory-copperbutterfly Branch NOT FOUND'