From 5f2fc46fccbfcfcb75dc4bfe9502c488c17f4bcc Mon Sep 17 00:00:00 2001 From: Brett Logan Date: Mon, 21 Feb 2022 11:16:27 -0500 Subject: [PATCH] Add logic --- .github/scripts/update-npm.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/scripts/update-npm.sh b/.github/scripts/update-npm.sh index f3097b7c..84d0a2b3 100755 --- a/.github/scripts/update-npm.sh +++ b/.github/scripts/update-npm.sh @@ -19,13 +19,17 @@ echo "Configuring Git..." git config --global user.email "noreply@github.com" git config --global user.name "Super-Linter Automation" -# Push changes to remote -echo "Pushing changes to remote..." -git add . -git commit -a -Ss -m "Update NPM dependencies" -git checkout -b "npm_deps_${id}" -git push origin "npm_deps_${id}" +if [[ $(git status --porcelain) ]]; then + # Push changes to remote + echo "Pushing changes to remote..." + git add . + git commit -a -Ss -m "Update NPM dependencies" + git checkout -b "npm_deps_${id}" + git push origin "npm_deps_${id}" -# Open pull request -echo "Opening pull request..." -gh pr create --title "Weekly NPM Updates" --body "Updates NPM dependencies" --base master --head "npm_deps_${id}" + # Open pull request + echo "Opening pull request..." + gh pr create --title "Weekly NPM Updates" --body "Updates NPM dependencies" --base master --head "npm_deps_${id}" +else + echo "No changes to commit" +fi