From aa801cd017cd68b7ceaa4716f7d7675e27048d77 Mon Sep 17 00:00:00 2001 From: "Iris (via Claude Code)" Date: Thu, 19 Feb 2026 05:41:37 -0800 Subject: [PATCH] fix: resolve 3 workflow automation bugs causing daily CI failures 1. Strip semver range prefix in version comparison (nextjs-version-check) - `require().dependencies.next` returns "^16.1.6" but npm view returns "16.1.6" - The caret prefix made the comparison always report "update needed" - Fix: strip non-numeric prefix before comparing 2. Replace Docker Compose with service containers (nextjs-version-check, catch-up-release) - `docker compose up -d && sleep 5` is fragile and caused Redis connection errors - `docker exec nextjs-cache-redis` references a container name that doesn't exist in CI - Fix: use GitHub Actions service containers with health checks, matching ci.yml pattern 3. Remove double-trigger in publish.yml - Triggered on both `push: tags` and `release: published` - Tag push runs the workflow, which creates a GitHub release at the end - That release re-triggers the workflow, which fails on duplicate npm publish - Fix: remove `release: published` trigger; tag push is sufficient Co-Authored-By: Claude Opus 4.6 --- .github/workflows/catch-up-release.yml | 26 +++++++++---------- .github/workflows/nextjs-version-check.yml | 29 +++++++++++----------- .github/workflows/publish.yml | 2 -- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/.github/workflows/catch-up-release.yml b/.github/workflows/catch-up-release.yml index f72963b..1404209 100644 --- a/.github/workflows/catch-up-release.yml +++ b/.github/workflows/catch-up-release.yml @@ -19,6 +19,17 @@ jobs: contents: write pull-requests: write + services: + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -102,13 +113,6 @@ jobs: if: steps.versions.outputs.needs_update == 'true' run: pnpm build - - name: Start Docker services - if: steps.versions.outputs.needs_update == 'true' - run: | - docker compose up -d - sleep 5 - docker ps - - name: Install Playwright browsers if: steps.versions.outputs.needs_update == 'true' run: | @@ -127,18 +131,14 @@ jobs: if: steps.versions.outputs.needs_update == 'true' id: test_redis run: | - # Flush Redis - docker exec nextjs-cache-redis redis-cli FLUSHALL + # Flush Redis (service container is accessible on localhost) + redis-cli -h localhost FLUSHALL # Build and test with Redis cd apps/e2e-test-app CACHE_HANDLER=redis pnpm build CACHE_HANDLER=redis pnpm test:e2e - - name: Stop Docker services - if: always() - run: docker compose down || true - - name: Create branch and commit if: steps.versions.outputs.needs_update == 'true' && inputs.dry_run != true run: | diff --git a/.github/workflows/nextjs-version-check.yml b/.github/workflows/nextjs-version-check.yml index abadc05..f26ed5d 100644 --- a/.github/workflows/nextjs-version-check.yml +++ b/.github/workflows/nextjs-version-check.yml @@ -13,6 +13,17 @@ jobs: contents: write pull-requests: write + services: + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + outputs: needs_update: ${{ steps.check_version.outputs.needs_update }} latest_version: ${{ steps.check_version.outputs.latest_version }} @@ -38,7 +49,8 @@ jobs: id: check_version run: | # Get current Next.js version from e2e-test-app (what we're testing against) - CURRENT_NEXTJS=$(node -p "require('./apps/e2e-test-app/package.json').dependencies.next") + # Strip semver range prefix (^, ~, >=, etc.) to get bare version for comparison + CURRENT_NEXTJS=$(node -p "require('./apps/e2e-test-app/package.json').dependencies.next.replace(/^[^0-9]*/, '')") echo "Current Next.js in e2e-test-app: $CURRENT_NEXTJS" # Get current package version @@ -139,13 +151,6 @@ jobs: if: steps.check_version.outputs.needs_update == 'true' && steps.branch_check.outputs.branch_exists != 'true' run: pnpm build - - name: Start Docker services - if: steps.check_version.outputs.needs_update == 'true' && steps.branch_check.outputs.branch_exists != 'true' - run: | - docker compose up -d - sleep 5 - docker ps - - name: Install Playwright browsers if: steps.check_version.outputs.needs_update == 'true' && steps.branch_check.outputs.branch_exists != 'true' run: | @@ -164,8 +169,8 @@ jobs: - name: Run e2e tests with Redis if: steps.check_version.outputs.needs_update == 'true' && steps.branch_check.outputs.branch_exists != 'true' run: | - # Flush Redis - docker exec nextjs-cache-redis redis-cli FLUSHALL + # Flush Redis (service container is accessible on localhost) + redis-cli -h localhost FLUSHALL # Build and test with Redis cd apps/e2e-test-app @@ -174,10 +179,6 @@ jobs: continue-on-error: true id: test_redis - - name: Stop Docker services - if: always() - run: docker compose down || true - - name: Commit changes if: steps.check_version.outputs.needs_update == 'true' && steps.branch_check.outputs.branch_exists != 'true' run: | diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 01cac3f..14e5798 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,6 @@ name: Publish to npm on: - release: - types: [published] push: tags: - "v*.*.*"