You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2024/04/12 10:06:15 UTC

(logging-parent) 03/07: Create non-existing branches in the site workflow

This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch release/11.0.0-test2
in repository https://gitbox.apache.org/repos/asf/logging-parent.git

commit 68ff577b416cc56aa01cdc6208dfc899dc4729a1
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Fri Apr 12 11:13:35 2024 +0200

    Create non-existing branches in the site workflow
---
 .github/workflows/deploy-site-reusable.yaml | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/deploy-site-reusable.yaml b/.github/workflows/deploy-site-reusable.yaml
index 44055e3..91edc7f 100644
--- a/.github/workflows/deploy-site-reusable.yaml
+++ b/.github/workflows/deploy-site-reusable.yaml
@@ -120,9 +120,17 @@ jobs:
           echo "SOURCE_COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
 
       - name: Checkout the target branch
-        uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633   # 4.1.2
-        with:
-          ref: ${{ inputs.target-branch }}
+        shell: bash
+        env:
+          TARGET_BRANCH: ${{ inputs.target-branch }}
+        run: |
+          git fetch -p
+          if [ $(git rev-parse --verify "origin/$TARGET_BRANCH" >/dev/null 2>&1) ]; then
+            git checkout -B "$TARGET_BRANCH" "origin/$TARGET_BRANCH"
+          else
+            echo "Branch \`$TARGET_BRANCH\` doesn't exist, creating it"
+            git checkout --orphan "$TARGET_BRANCH"
+          fi
 
       - name: Update the target path
         shell: bash