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 0918780
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ 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 0918780

Please sign in to comment.