diff --git a/.github/workflows/upgrade-deps.yml b/.github/workflows/upgrade-deps.yml index aa2616fdd..eb340a604 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 }}