From 29bbd2eecc97aaaa95c61f8fb736d1301042aa91 Mon Sep 17 00:00:00 2001 From: welpo Date: Fri, 29 Nov 2024 13:16:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20misc(deps):=20check=20for=20exis?= =?UTF-8?q?ting=20branch=20upgrades?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upgrade-deps.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/upgrade-deps.yml b/.github/workflows/upgrade-deps.yml index aa2616f..eb340a6 100644 --- a/.github/workflows/upgrade-deps.yml +++ b/.github/workflows/upgrade-deps.yml @@ -48,6 +48,22 @@ jobs: git config --global user.name "welpo" git config --global user.email "welpo@users.noreply.github.com" + - name: Check for existing branch + id: check_branch + run: | + if git ls-remote --heads origin deps/upgrade-${{ matrix.dependency }} | grep -q deps/upgrade-${{ matrix.dependency }}; then + echo "branch_exists=true" >> $GITHUB_OUTPUT + else + echo "branch_exists=false" >> $GITHUB_OUTPUT + fi + + - name: Handle existing branch + if: steps.check_branch.outputs.branch_exists == 'true' + run: | + echo "Branch deps/upgrade-${{ matrix.dependency }} already exists." + echo "Skipping upgrade as there's already an open PR" + exit 0 + - name: Create and switch to new branch run: | git checkout -b deps/upgrade-${{ matrix.dependency }}