Skip to content

Commit a5ad740

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

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v6
18+
with:
19+
fetch-depth: 0
1820

1921
- name: Setup Node.js
2022
uses: actions/setup-node@v6
2123
with:
22-
node-version: '20'
24+
node-version: "20"
2325

2426
- name: Install dependencies
2527
run: npm ci
@@ -43,7 +45,24 @@ jobs:
4345
run: |
4446
npx spectral lint schemas/core/openapi.yaml schemas/gcp/openapi.yaml --format github-actions --fail-severity warn
4547
48+
- name: Check for contract changes
49+
id: contract
50+
run: |
51+
BASE_REF="${{ github.event.pull_request.base.sha || github.event.before }}"
52+
if [ -z "$BASE_REF" ] || ! git cat-file -e "$BASE_REF" 2>/dev/null; then
53+
echo "changed=true" >> "$GITHUB_OUTPUT"
54+
exit 0
55+
fi
56+
CHANGED=$(git diff --name-only "$BASE_REF" HEAD -- '*.tsp')
57+
if [ -n "$CHANGED" ]; then
58+
echo "changed=true" >> "$GITHUB_OUTPUT"
59+
else
60+
echo "changed=false" >> "$GITHUB_OUTPUT"
61+
echo "No contract files changed — skipping version bump check"
62+
fi
63+
4664
- name: Check version bump
65+
if: steps.contract.outputs.changed == 'true'
4766
env:
4867
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4968
run: |

0 commit comments

Comments
 (0)