From b760841e58486b4363524bb2cc3c8f1e0aaca8e4 Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sat, 13 Sep 2025 13:49:23 +0200 Subject: [PATCH 1/2] Fix workflow to run as required status check before merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 🚀 Features - Added `validate` job that runs on version branch PRs as required status check - Added pre-merge validation with tests, build, and branch type detection ### 🐛 Bug Fixes - Fixed workflow timing: now blocks PR merge until validation passes - Changed trigger from `types: [closed]` to `types: [opened, synchronize, reopened]` - Separated validation (PR) from publishing (post-merge) workflows ### 🔧 Improvements - Version publishing only runs after successful merge to main - Clear messaging about release type during PR validation - Prevents immediate PR closure before workflow completion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/version-and-publish.yml | 55 +++++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/.github/workflows/version-and-publish.yml b/.github/workflows/version-and-publish.yml index 43adb2c..194365b 100644 --- a/.github/workflows/version-and-publish.yml +++ b/.github/workflows/version-and-publish.yml @@ -7,11 +7,60 @@ on: pull_request: branches: - main - types: [closed] + types: [opened, synchronize, reopened] jobs: + validate: + if: github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'major/') || startsWith(github.event.pull_request.head.ref, 'minor/') || startsWith(github.event.pull_request.head.ref, 'patch/')) + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 8 + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v4 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run tests + run: pnpm test + + - name: Run build + run: pnpm build + + - name: Validate version branch + run: | + echo "✅ Version branch validation passed" + if [[ "${{ github.event.pull_request.head.ref }}" =~ ^major/ ]]; then + echo "🚀 This will create a MAJOR release when merged" + elif [[ "${{ github.event.pull_request.head.ref }}" =~ ^minor/ ]]; then + echo "✨ This will create a MINOR release when merged" + else + echo "🐛 This will create a PATCH release when merged" + fi + version-and-publish: - if: github.event_name == 'push' || (github.event.pull_request.merged == true && (startsWith(github.event.pull_request.head.ref, 'major/') || startsWith(github.event.pull_request.head.ref, 'minor/') || startsWith(github.event.pull_request.head.ref, 'patch/'))) + if: github.event_name == 'push' runs-on: ubuntu-latest outputs: new-version: ${{ steps.version-bump.outputs.new-version }} @@ -333,7 +382,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} notify-success: - if: github.event_name == 'push' || (github.event.pull_request.merged == true && (startsWith(github.event.pull_request.head.ref, 'major/') || startsWith(github.event.pull_request.head.ref, 'minor/') || startsWith(github.event.pull_request.head.ref, 'patch/'))) + if: github.event_name == 'push' needs: version-and-publish runs-on: ubuntu-latest steps: From 14c03b21430ed999a596e7a6081984876f328e7e Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sat, 13 Sep 2025 13:49:46 +0200 Subject: [PATCH 2/2] Fix pnpm version mismatch in GitHub Actions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 🐛 Bug Fixes - Updated pnpm version from 8 to 10 to match package.json packageManager field - Resolves ERR_PNPM_BAD_PM_VERSION error in workflow execution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/version-and-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/version-and-publish.yml b/.github/workflows/version-and-publish.yml index 194365b..b10b3bf 100644 --- a/.github/workflows/version-and-publish.yml +++ b/.github/workflows/version-and-publish.yml @@ -25,7 +25,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10 - name: Get pnpm store directory shell: bash @@ -84,7 +84,7 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 with: - version: 8 + version: 10 - name: Get pnpm store directory shell: bash