diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3fa3580..b407f69a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,14 +72,15 @@ jobs: - name: Validate changesets run: | - if [ -z "$(ls .changeset/*.md 2>/dev/null)" ]; then + # Check if .changeset directory exists and contains .md files + if [ ! -d .changeset ] || [ -z "$(find .changeset -name '*.md' -type f 2>/dev/null | head -1)" ]; then echo "❌ No changesets found. Please create changesets locally with 'pnpm changeset' before releasing." echo "Changesets should be created during development, not during release." exit 1 else - echo "✅ Found $(ls .changeset/*.md | wc -l) changeset(s)" + echo "✅ Found $(find .changeset -name '*.md' -type f | wc -l) changeset(s)" echo "Changesets:" - ls .changeset/*.md + find .changeset -name '*.md' -type f fi - name: Create Release Pull Request or Publish @@ -100,13 +101,13 @@ jobs: echo "🔍 This is a dry run. The following changes would be made:" echo "" echo "📋 Changeset contents:" - for file in .changeset/*.md; do + while IFS= read -r -d '' file; do if [ -f "$file" ]; then echo "--- $file ---" cat "$file" echo "" fi - done + done < <(find .changeset -name '*.md' -type f -print0 2>/dev/null) echo "đŸ“Ļ Version changes that would be applied:" pnpm changeset version --dry-run diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 23f9e199..1016f793 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,6 +14,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 @@ -31,12 +33,55 @@ jobs: - name: Run format check run: pnpm format + # Determine which packages have changed + - name: Determine changed packages + id: quality-changes + uses: dorny/paths-filter@v2 + with: + filters: | + react: + - 'packages/react/**' + angular: + - 'packages/angular/**' + + - name: Check for changesets + run: | + # Check if any packages have changed + packages_changed=$([[ "${{ steps.quality-changes.outputs.react }}" == "true" ]] || [[ "${{ steps.quality-changes.outputs.angular }}" == "true" ]]) + if [[ "$packages_changed" == "true" ]]; then + # Check if .changeset directory exists and contains .md files + if [ ! -d .changeset ] || [ -z "$(find .changeset -name '*.md' -type f 2>/dev/null | head -1)" ]; then + echo "❌ Changes detected in packages but no changesets found." + echo "" + echo "Please create a changeset with 'pnpm changeset' for changes that should be released." + echo "If these changes don't need a release, please add a comment explaining why." + echo "" + echo "Changed packages:" + if [[ "${{ steps.quality-changes.outputs.react }}" == "true" ]]; then + echo "- React package" + fi + if [[ "${{ steps.quality-changes.outputs.angular }}" == "true" ]]; then + echo "- Angular package" + fi + exit 1 + else + echo "✅ Found changesets for package changes" + echo "" + echo "Changesets:" + find .changeset -name '*.md' -type f + fi + else + echo "â„šī¸ No package changes detected, skipping changeset check" + fi + test: runs-on: ubuntu-latest needs: quality steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4