Skip to content

Commit ff9f01d

Browse files
committed
HYPERFLEET-930 - ci: skip version bump check for non-contract PRs
Only require version bump when .tsp files change. Docs, CI, and tooling changes no longer trigger unnecessary releases.
1 parent 5c39355 commit ff9f01d

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,24 @@ jobs:
3939
run: |
4040
npx spectral lint schemas/core/openapi.yaml --format github-actions --fail-severity warn
4141
42+
- name: Check for contract changes
43+
id: contract
44+
run: |
45+
BASE_REF="${{ github.event.pull_request.base.sha || github.event.before }}"
46+
if [ -z "$BASE_REF" ] || ! git cat-file -e "$BASE_REF" 2>/dev/null; then
47+
echo "changed=true" >> "$GITHUB_OUTPUT"
48+
exit 0
49+
fi
50+
CHANGED=$(git diff --name-only "$BASE_REF" HEAD -- '*.tsp')
51+
if [ -n "$CHANGED" ]; then
52+
echo "changed=true" >> "$GITHUB_OUTPUT"
53+
else
54+
echo "changed=false" >> "$GITHUB_OUTPUT"
55+
echo "No contract files changed — skipping version bump check"
56+
fi
57+
4258
- name: Check version bump
59+
if: steps.contract.outputs.changed == 'true'
4360
env:
4461
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4562
run: |

AGENTS.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
TypeSpec sources that generate the HyperFleet core OpenAPI specification. Published as the `hyperfleet` npm package for provider-specific repos (e.g., `hyperfleet-api-spec-gcp`). Also consumed as a Go module via `schemas/schemas.go` (`embed.FS`).
44

5-
## Critical path
5+
## Verification
66

7-
```bash
8-
npm install # Install TypeSpec compiler + deps
9-
./build-schema.sh # Build core OpenAPI spec
10-
npx spectral lint schemas/core/openapi.yaml --fail-severity warn # Lint (matches CI strictness)
11-
```
7+
| Command | What it does |
8+
|---|---|
9+
| `npm install` | Install TypeSpec compiler + deps |
10+
| `./build-schema.sh` | Build core OpenAPI spec |
11+
| `npx spectral lint schemas/core/openapi.yaml --fail-severity warn` | Lint (matches CI strictness) |
12+
13+
Pre-push order: `npm install``./build-schema.sh``spectral lint`.
1214

1315
**IMPORTANT:** `schemas/core/openapi.yaml` is committed. CI runs `git diff --exit-code schemas/` — if you change TypeSpec sources, rebuild and commit the schema in the same PR.
1416

15-
**IMPORTANT:** Every PR must bump the version in `main.tsp` (the `version` field inside the `@info` decorator). CI compares against the latest release tag and blocks if unchanged or lower.
17+
**IMPORTANT:** PRs that change `.tsp` files must bump the version in `main.tsp` (the `version` field inside the `@info` decorator). CI compares against the latest release tag and blocks if unchanged or lower. Non-contract PRs (docs, CI, tooling) skip this check.
1618

1719
When bumping version:
1820
1. Edit the `version` field inside the `@info` decorator in `main.tsp`

0 commit comments

Comments
 (0)