From 1a8437b891ff4e4c6982255dcda41dab529fc69c Mon Sep 17 00:00:00 2001 From: Linearb CI Date: Mon, 19 Jan 2026 17:53:41 +0200 Subject: [PATCH] Improve error handling in git commands within action.yml - Added warnings for failed fetch of the head branch if it has been deleted and ensure the action continues even if a checkout fails. --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 11420b9f..865c368b 100644 --- a/action.yml +++ b/action.yml @@ -86,10 +86,10 @@ runs: git config checkout.defaultRemote origin git fetch --shallow-since="6 months ago" origin $'${{ steps.safe-strings.outputs.base_ref }}' git remote add upstream $'${{ steps.safe-strings.outputs.url }}' - git fetch --shallow-since="6 months ago" upstream $'${{ steps.safe-strings.outputs.head_ref }}' - git checkout -b $'upstream/${{ steps.safe-strings.outputs.head_ref}}' $'upstream/${{ steps.safe-strings.outputs.head_ref}}' - git checkout $'${{ steps.safe-strings.outputs.base_ref }}' - git checkout $'${{ steps.safe-strings.outputs.head_ref }}' + git fetch --shallow-since="6 months ago" upstream $'${{ steps.safe-strings.outputs.head_ref }}' || echo "::warning::Failed to fetch head branch. The branch may have been deleted." + git checkout -b $'upstream/${{ steps.safe-strings.outputs.head_ref}}' $'upstream/${{ steps.safe-strings.outputs.head_ref}}' || true + git checkout $'${{ steps.safe-strings.outputs.base_ref }}' || true + git checkout $'${{ steps.safe-strings.outputs.head_ref }}' || true - name: Create cm folder shell: bash