From 3c6c91075fb685168030135f14f82fc7edad66a6 Mon Sep 17 00:00:00 2001 From: wolfcomp Date: Mon, 16 Jan 2023 09:09:01 +0100 Subject: [PATCH] chore: fix CS GHA not resetting head for pulling branch if exists --- .github/workflows/update-submodules.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index 3e0c24a33..29e86d09c 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -33,6 +33,7 @@ jobs: - name: Update submodule run: | git checkout -b csupdate-${{ matrix.branches }} + git reset --hard origin/${{ matrix.branches }} cd lib/FFXIVClientStructs git fetch git reset --hard origin/main @@ -43,4 +44,11 @@ jobs: - name: Create PR run: | echo ${{ secrets.UPDATE_PAT }} | gh auth login --with-token + prNumber=$(gh pr list --base ${{ matrix.branches }} --head csupdate-${{ matrix.branches }} --state open --json number --template "{{range .}}{{.number}}{{end}}") + if [ -z "$prNumber" ]; then + echo "No PR found, creating one" + else + echo "PR already exists, closing it" + gh pr close $prNumber + fi gh pr create --head csupdate-${{ matrix.branches }} --title "[${{ matrix.branches }}] Update ClientStructs" --body "" --base ${{ matrix.branches }}