feat: support destination based configuration #303
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check Version Bump | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-version-bump: | |
| name: Check Version Bump | |
| runs-on: ${{ contains(github.server_url, 'github.com') && 'ubuntu-latest' || fromJSON('["self-hosted"]') }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check that version was bumped if src/ was modified | |
| run: | | |
| BASE_SHA="${{ github.event.pull_request.base.sha }}" | |
| HEAD_SHA="${{ github.event.pull_request.head.sha }}" | |
| CHANGED_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA") | |
| if echo "$CHANGED_FILES" | grep -qE "^src/.*\.(py|pyi|proto)$"; then | |
| BASE_VERSION=$(git show "$BASE_SHA:pyproject.toml" | grep "^version = " | cut -d'"' -f2) | |
| HEAD_VERSION=$(git show "$HEAD_SHA:pyproject.toml" | grep "^version = " | cut -d'"' -f2) | |
| if [ "$BASE_VERSION" = "$HEAD_VERSION" ]; then | |
| echo "ERROR: Source files under src/ were modified but the version in pyproject.toml was not bumped (still $HEAD_VERSION)." | |
| exit 1 | |
| fi | |
| HIGHER=$(printf '%s\n' "$BASE_VERSION" "$HEAD_VERSION" | sort -V | tail -1) | |
| if [ "$HIGHER" != "$HEAD_VERSION" ]; then | |
| echo "ERROR: Version regression detected. Base is $BASE_VERSION but PR has $HEAD_VERSION." | |
| exit 1 | |
| fi | |
| echo "Version bump OK: $BASE_VERSION → $HEAD_VERSION" | |
| else | |
| echo "No source file changes under src/. Version bump not required." | |
| fi |