From 868c70511ab0e055f84c2b0798ee5705778ec68e Mon Sep 17 00:00:00 2001 From: Nick McCready Date: Fri, 13 Mar 2026 22:03:08 -0400 Subject: [PATCH] fix: dynamic version test + upgrade setup-node to v4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Read version from package.json in test instead of hardcoding v0.1.0 - This was causing all CI to fail after version bumps (tests → release → publish) - Upgrade actions/setup-node from v3 to v4 (Node.js 20 deprecation warning) --- .github/workflows/commitlint.yml | 2 +- .github/workflows/tests.yml | 2 +- test/sync-agents.bats | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index de14612..28172e4 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -24,7 +24,7 @@ jobs: sudo apt install -y sudo sudo apt install -y git curl - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 20 - name: node setup diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6be79c4..116c6b0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} # cache: "npm" # needs lockfile if enabled diff --git a/test/sync-agents.bats b/test/sync-agents.bats index 40d62f8..7319957 100644 --- a/test/sync-agents.bats +++ b/test/sync-agents.bats @@ -2,6 +2,8 @@ # Resolve the script under test relative to this test file SCRIPT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../src/sh" && pwd)/sync-agents.sh" +# Read version from package.json so the test stays in sync after bumps +PACKAGE_VERSION="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)/package.json" | head -1)" setup() { # Create a temporary directory for each test @@ -41,7 +43,7 @@ teardown() { @test "--version shows version from package.json" { run bash "$SCRIPT" --version [ "$status" -eq 0 ] - [[ "$output" == *"sync-agents v0.1.0"* ]] + [[ "$output" == *"sync-agents v${PACKAGE_VERSION}"* ]] } # --------------------------------------------------------------------------