Skip to content

Commit 2711b1b

Browse files
committed
fix(ci): improve mobile-only commit detection in release workflow
1 parent 5dd530d commit 2711b1b

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,32 @@ jobs:
7272
- name: Check for mobile-only commits
7373
id: check_commits
7474
run: |
75-
COMMITS=$(git log $(git describe --tags --abbrev=0 2>/dev/null || echo "")..HEAD --pretty=format:"%s" || git log --pretty=format:"%s")
76-
HAS_MOBILE=$(echo "$COMMITS" | grep -c "(mobile)" || echo "0")
77-
HAS_NON_MOBILE=$(echo "$COMMITS" | grep -v "(mobile)" | grep -v "\[skip ci\]" | grep -c "" || echo "0")
75+
# Get commits since last tag
76+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
77+
if [ -z "$LAST_TAG" ]; then
78+
COMMITS=$(git log --pretty=format:"%s")
79+
else
80+
COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=format:"%s")
81+
fi
82+
83+
echo "Commits since last tag:"
84+
echo "$COMMITS"
85+
86+
# Count mobile commits
87+
HAS_MOBILE=$(echo "$COMMITS" | grep -E '\(mobile\)' | wc -l || echo "0")
88+
89+
# Count non-mobile commits (excluding [skip ci] and chore(release) commits)
90+
HAS_NON_MOBILE=$(echo "$COMMITS" | grep -v -E '\(mobile\)' | grep -v -E '\[skip ci\]' | grep -v -E '^chore\(release\):' | grep -v -E '^chore\(mobile\):' | grep -E '.' | wc -l || echo "0")
91+
92+
echo "Mobile commits: $HAS_MOBILE"
93+
echo "Non-mobile commits: $HAS_NON_MOBILE"
7894
7995
if [ "$HAS_MOBILE" -gt 0 ] && [ "$HAS_NON_MOBILE" -eq 0 ]; then
8096
echo "skip_release=true" >> $GITHUB_OUTPUT
81-
echo "Mobile-only commits detected, skipping semantic-release"
97+
echo "Mobile-only commits detected, skipping semantic-release"
8298
else
8399
echo "skip_release=false" >> $GITHUB_OUTPUT
84-
echo "Non-mobile commits detected, running semantic-release"
100+
echo "Non-mobile commits detected, running semantic-release"
85101
fi
86102
87103
- name: Bump mobile version only

0 commit comments

Comments
 (0)