Skip to content

@W-22571806 Set up MCP Apps dependencies and basic server structure #194

@W-22571806 Set up MCP Apps dependencies and basic server structure

@W-22571806 Set up MCP Apps dependencies and basic server structure #194

name: Version Bump Check
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
jobs:
check-version:
runs-on: ubuntu-latest
# Skip for dependabot - dependency updates don't require version bumps
if: github.actor != 'dependabot[bot]'
steps:
- name: Checkout PR head
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check version bump
env:
BASE_REF: ${{ github.base_ref }}
run: |
set -euo pipefail
git fetch origin "$BASE_REF" --depth=1
# Skip if this PR does not touch src/.
# Using three-dot diff against the merge base of origin/$BASE_REF and HEAD
# so we only look at changes introduced by this PR, not changes that
# landed on the base branch after the PR was opened.
if ! git diff --name-only "origin/$BASE_REF...HEAD" -- 'src/**' | grep -q .; then
echo "No changes under src/; skipping version bump check."
exit 0
fi
PR_VERSION=$(jq -r '.version' package.json)
if [[ -z "$PR_VERSION" || "$PR_VERSION" == "null" ]]; then
echo "::error::Could not read version from package.json"
exit 1
fi
BASE_VERSION=$(git show "origin/$BASE_REF:package.json" | jq -r '.version')
if [[ -z "$BASE_VERSION" || "$BASE_VERSION" == "null" ]]; then
echo "::error::Could not read version from base branch package.json"
exit 1
fi
echo "PR version: $PR_VERSION"
echo "Base version: $BASE_VERSION"
if [[ "$PR_VERSION" == "$BASE_VERSION" ]]; then
echo ""
echo "::error::Version in package.json ($PR_VERSION) has not been bumped."
echo ""
echo "Please bump the version before merging:"
echo " npm run version:patch # for bug fixes"
echo " npm run version:minor # for new features"
echo " npm run version:major # for breaking changes"
exit 1
fi
echo ""
echo "Version bumped from $BASE_VERSION to $PR_VERSION"