From 94bb880160909e70fc605d4b1424d42811ee985e Mon Sep 17 00:00:00 2001 From: Macsim Date: Thu, 10 Jul 2025 21:48:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B0=D1=88=D1=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b58dd21..daa293b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,10 +161,16 @@ jobs: run: | echo "Checking branch status before PR..." git fetch origin - git log ${BRANCH_NAME} -1 - git diff origin/main origin/${BRANCH_NAME} || echo "No diff between main and ${BRANCH_NAME}" - echo "Creating Pull Request..." - gh pr create --base main --head ${BRANCH_NAME} --title "Update of repositories $(date +'%Y-%m-%d %H:%M:%S')" --body "Automated PR for repository updates" + # Check if the branch exists in the remote repository + if git ls-remote --exit-code --heads origin ${BRANCH_NAME} >/dev/null 2>&1; then + echo "Branch ${BRANCH_NAME} exists in remote repository." + git log origin/${BRANCH_NAME} -1 || echo "Failed to view log for ${BRANCH_NAME}" + git diff origin/main origin/${BRANCH_NAME} || echo "No diff between main and ${BRANCH_NAME}" + echo "Creating Pull Request..." + gh pr create --base main --head ${BRANCH_NAME} --title "Update of repositories $(date +'%Y-%m-%d %H:%M:%S')" --body "Automated PR for repository updates" || echo "Failed to create PR" + else + echo "Branch ${BRANCH_NAME} does not exist in remote repository, skipping PR creation." + fi backup: runs-on: ubuntu-latest