From 8a49a11dc0c8b6de8ec53e76c822bcefca8a193a Mon Sep 17 00:00:00 2001 From: KazWolfe Date: Tue, 4 Nov 2025 12:18:38 -0800 Subject: [PATCH] fix: dont nag maintainers when nothing needs to be done (#2418) --- .github/workflows/update-submodules.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml index 686974ad5..af597fc58 100644 --- a/.github/workflows/update-submodules.yml +++ b/.github/workflows/update-submodules.yml @@ -41,6 +41,7 @@ jobs: git config --global user.email noreply@github.com git config --global pull.rebase false - name: Update submodule + id: update-submodule run: | git checkout -b ${{ matrix.submodule.branch-prefix }}-${{ matrix.branches }} git reset --hard origin/${{ matrix.branches }} @@ -49,9 +50,19 @@ jobs: git reset --hard origin/${{ matrix.submodule.branch }} cd ../.. git add ${{ matrix.submodule.path }} + + if [[ -z "$(git status --porcelain --untracked-files=no)" ]]; then + echo "No changes detected!" + echo "SUBMIT_PR=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + git commit --message "Update ${{ matrix.submodule.name }}" git push origin ${{ matrix.submodule.branch-prefix }}-${{ matrix.branches }} --force + echo "SUBMIT_PR=true" >> "$GITHUB_OUTPUT" + - name: Create PR + if: ${{ steps.update-submodule.outputs.SUBMIT_PR == 'true' }} run: | echo ${{ secrets.UPDATE_PAT }} | gh auth login --with-token prNumber=$(gh pr list --base ${{ matrix.branches }} --head ${{ matrix.submodule.branch-prefix }}-${{ matrix.branches }} --state open --json number --template "{{range .}}{{.number}}{{end}}")