From 3c6c91075fb685168030135f14f82fc7edad66a6 Mon Sep 17 00:00:00 2001 From: wolfcomp Date: Mon, 16 Jan 2023 09:09:01 +0100 Subject: [PATCH 1/3] 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 }} From 43690223c529a0a3e7ebd5ad03d45bc81f1372ac Mon Sep 17 00:00:00 2001 From: wolfcomp <4028289+wolfcomp@users.noreply.github.com> Date: Mon, 16 Jan 2023 09:14:54 +0100 Subject: [PATCH 2/3] chore: force push due to hard reset --- .github/workflows/update-submodules.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index 29e86d09c..aff4d416c 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -40,7 +40,7 @@ jobs: cd ../.. git add lib/FFXIVClientStructs git commit --message "Update ClientStructs" - git push origin csupdate-${{ matrix.branches }} + git push origin csupdate-${{ matrix.branches }} --force - name: Create PR run: | echo ${{ secrets.UPDATE_PAT }} | gh auth login --with-token From 425a4d7c185265e827915cf0b7f0fd9113fdb2e2 Mon Sep 17 00:00:00 2001 From: wolfcomp <4028289+wolfcomp@users.noreply.github.com> Date: Mon, 16 Jan 2023 15:16:56 +0100 Subject: [PATCH 3/3] chore: ignore creating a pr if one exists --- .github/workflows/update-submodules.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index aff4d416c..19bd86b30 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -47,8 +47,7 @@ jobs: 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" + gh pr create --head csupdate-${{ matrix.branches }} --title "[${{ matrix.branches }}] Update ClientStructs" --body "" --base ${{ matrix.branches }} else - echo "PR already exists, closing it" - gh pr close $prNumber + echo "PR already exists, ignoring" fi - gh pr create --head csupdate-${{ matrix.branches }} --title "[${{ matrix.branches }}] Update ClientStructs" --body "" --base ${{ matrix.branches }}