From f9116deefb7413b440603c0549d171a0ccebf880 Mon Sep 17 00:00:00 2001 From: XuHwang Date: Mon, 6 Jan 2025 09:42:19 +0800 Subject: [PATCH] add logic to push only when there are changes in the submodules --- .github/workflows/update_submodule.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_submodule.yaml b/.github/workflows/update_submodule.yaml index 78a8020..2dfddf0 100644 --- a/.github/workflows/update_submodule.yaml +++ b/.github/workflows/update_submodule.yaml @@ -20,9 +20,16 @@ jobs: - name: Update submodules to latest commit run: | - git config --global user.name "$GitHub Actions Bot" + git config --global user.name "GitHub Actions Bot" git config --global user.email "actions-bot@users.noreply.github.com" git submodule update --remote --merge - git add . - git commit -m "Update submodules to latest" - git push origin main \ No newline at end of file + + if [[ $(git status --porcelain) ]]; then + # Check if there are changes + echo "Changes detected, committing and pushing..." + git add . + git commit -m "Update submodules to latest" + git push origin main + else + echo "No changes detected, skipping commit and push." + fi \ No newline at end of file