From 53c9dbeb793e1b62ee05e88d36495db2d3aab1c0 Mon Sep 17 00:00:00 2001 From: Ciaran Roche Date: Tue, 13 Oct 2026 15:55:27 +0100 Subject: [PATCH] HYPERFLEET-1762 - ci: skip the version bump check when no contract file changed The check failed every PR whose main.tsp version equals the latest release, so a PR that does not touch the spec, such as an OWNERS change, could never pass. Port the contract change detection hyperfleet-api-spec already uses: the version bump is required only when a .tsp file differs from the base of the push or pull request. --- .github/workflows/ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3a4309..a4ed8d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v6 + with: + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v6 @@ -39,7 +41,24 @@ jobs: run: | npx spectral lint schemas/template/openapi.yaml --format github-actions --fail-severity warn + - name: Check for contract changes + id: contract + run: | + BASE_REF="${{ github.event.pull_request.base.sha || github.event.before }}" + if [ -z "$BASE_REF" ] || ! git cat-file -e "$BASE_REF" 2>/dev/null; then + echo "changed=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + CHANGED=$(git diff --name-only "$BASE_REF" HEAD -- '*.tsp') + if [ -n "$CHANGED" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "No contract files changed, skipping version bump check" + fi + - name: Check version bump + if: steps.contract.outputs.changed == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: |