Skip to content

Commit

Permalink
Refactor build CD workflow
Browse files Browse the repository at this point in the history
Improve the build CD workflow to prevent errors in situations where there are no changes to commit. Added an if-else statement to appropriately handle such scenarios.
  • Loading branch information
Wang-Yan-Hao committed Jan 25, 2024
1 parent 4a1ca4b commit b60818e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
find . -maxdepth 1 -mindepth 1 ! -name 'build' ! -name '.git' -exec rm -rf {} \;
mv build/* .
rm -rf build
git add .
git commit -m "Auto-generated build files"
git push origin build
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Auto-generated build files"
git push origin build
else
echo "No changes to commit. Skipping deployment."
fi

0 comments on commit b60818e

Please sign in to comment.