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 09:21:36 UTC

(logging-parent) branch main updated: Fix pushes on non-existing remote branches

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

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


The following commit(s) were added to refs/heads/main by this push:
     new a9d6b2d  Fix pushes on non-existing remote branches
a9d6b2d is described below

commit a9d6b2db1204d618aba2195de06a1cf68be48c68
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Fri Apr 12 11:21:28 2024 +0200

    Fix pushes on non-existing remote branches
---
 .github/workflows/deploy-site-reusable.yaml | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/deploy-site-reusable.yaml b/.github/workflows/deploy-site-reusable.yaml
index 91edc7f..4b6e9be 100644
--- a/.github/workflows/deploy-site-reusable.yaml
+++ b/.github/workflows/deploy-site-reusable.yaml
@@ -135,6 +135,7 @@ jobs:
       - name: Update the target path
         shell: bash
         env:
+          TARGET_BRANCH: ${{ inputs.target-branch }}
           TARGET_PATH: ${{ inputs.target-path }}
           ASF_YAML_CONTENT: ${{ inputs.asf-yaml-content }}
         run: |
@@ -144,13 +145,13 @@ jobs:
 
           # Clean up the target path
           if [ "." = "$TARGET_PATH" ]; then
-            git ls-files -z | xargs -0 git rm -rf
+            git ls-files -z | xargs -0 git rm -rfq
           else
-            git rm -rf "$TARGET_PATH"
+            git rm -rfq "$TARGET_PATH"
           fi
 
           # Place the generated site
-          unzip /tmp/site.zip -d "$TARGET_PATH"
+          unzip -q /tmp/site.zip -d "$TARGET_PATH"
           git add "$TARGET_PATH"
 
           # Recover `.asf.yaml`, if there was one.
@@ -169,7 +170,8 @@ jobs:
 
             # Commit & push site changes
             git commit -S -a -m "Add website content generated from \`$SOURCE_COMMIT_ID\`"
-            git push -f origin
+            # `push` needs an explicit target branch and `-u` for tracking it, since we might have just created it
+            git push -f -u origin "$TARGET_BRANCH"
 
             # Populate `.asf.yaml`
             cat >.asf.yaml <<EOF