Skip to content

Commit 7aaebe2

Browse files
committed
optimized commit in ci.yaml
1 parent 2314ec2 commit 7aaebe2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

.github/workflows/ci.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,19 @@ jobs:
8080
- name: Commit and push badges
8181
if: github.event_name != 'pull_request'
8282
run: |
83-
cd .github/badges
84-
if [[ `git status --porcelain` ]]; then
85-
git config --global user.name 'github-actions'
86-
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
87-
git add *.svg
88-
git add *.json
89-
if ! git diff --cached --quiet; then
90-
git commit -m "Update coverage badges for all modules"
91-
git push
92-
fi
83+
git config --global user.name 'github-actions'
84+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
85+
86+
# 1. Stage the specific files
87+
git add .github/badges/*.svg
88+
git add .github/badges/*.json
89+
90+
# 2. Check if the STAGED changes are different from the last commit
91+
# git diff --cached --quiet returns 1 if there are differences
92+
if ! git diff --cached --quiet; then
93+
git commit -m "Update coverage badges"
94+
git push
95+
else
96+
echo "No changes in coverage results; skipping commit."
9397
fi
98+

0 commit comments

Comments
 (0)