Skip to content

Commit 1bfef8f

Browse files
committed
fix(CI): make workflows more robust, replacing ls with find
1 parent cffcb65 commit 1bfef8f

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ jobs:
7272

7373
- name: Validate changesets
7474
run: |
75-
if [ -z "$(ls .changeset/*.md 2>/dev/null)" ]; then
75+
# Check if .changeset directory exists and contains .md files
76+
if [ ! -d .changeset ] || [ -z "$(find .changeset -name '*.md' -type f 2>/dev/null | head -1)" ]; then
7677
echo "❌ No changesets found. Please create changesets locally with 'pnpm changeset' before releasing."
7778
echo "Changesets should be created during development, not during release."
7879
exit 1
7980
else
80-
echo "✅ Found $(ls .changeset/*.md | wc -l) changeset(s)"
81+
echo "✅ Found $(find .changeset -name '*.md' -type f | wc -l) changeset(s)"
8182
echo "Changesets:"
82-
ls .changeset/*.md
83+
find .changeset -name '*.md' -type f
8384
fi
8485
8586
- name: Create Release Pull Request or Publish
@@ -100,13 +101,13 @@ jobs:
100101
echo "🔍 This is a dry run. The following changes would be made:"
101102
echo ""
102103
echo "📋 Changeset contents:"
103-
for file in .changeset/*.md; do
104+
while IFS= read -r -d '' file; do
104105
if [ -f "$file" ]; then
105106
echo "--- $file ---"
106107
cat "$file"
107108
echo ""
108109
fi
109-
done
110+
done < <(find .changeset -name '*.md' -type f -print0 2>/dev/null)
110111
111112
echo "📦 Version changes that would be applied:"
112113
pnpm changeset version --dry-run

.github/workflows/tests.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ jobs:
4747
- name: Check for changesets
4848
run: |
4949
# Check if any packages have changed
50-
if [[ "${{ steps.quality-changes.outputs.react }}" == "true" ]] || [[ "${{ steps.quality-changes.outputs.angular }}" == "true" ]]; then
50+
packages_changed=$([[ "${{ steps.quality-changes.outputs.react }}" == "true" ]] || [[ "${{ steps.quality-changes.outputs.angular }}" == "true" ]])
51+
if [[ "$packages_changed" == "true" ]]; then
5152
# Check if .changeset directory exists and contains .md files
52-
if [ ! -d .changeset ] || [ -z "$(ls .changeset/*.md 2>/dev/null)" ]; then
53+
if [ ! -d .changeset ] || [ -z "$(find .changeset -name '*.md' -type f 2>/dev/null | head -1)" ]; then
5354
echo "❌ Changes detected in packages but no changesets found."
5455
echo ""
5556
echo "Please create a changeset with 'pnpm changeset' for changes that should be released."
@@ -67,7 +68,7 @@ jobs:
6768
echo "✅ Found changesets for package changes"
6869
echo ""
6970
echo "Changesets:"
70-
ls .changeset/*.md
71+
find .changeset -name '*.md' -type f
7172
fi
7273
else
7374
echo "ℹ️ No package changes detected, skipping changeset check"
@@ -79,6 +80,8 @@ jobs:
7980
steps:
8081
- name: Checkout code
8182
uses: actions/checkout@v4
83+
with:
84+
fetch-depth: 0
8285

8386
- name: Setup Node.js
8487
uses: actions/setup-node@v4

0 commit comments

Comments
 (0)