Skip to content

Refctor/qt mvc refactor #4

Refctor/qt mvc refactor

Refctor/qt mvc refactor #4

name: API Change Detection
on:
pull_request:
branches: [ mainline, release, feature_*, 'patch_*' ]
jobs:
check-api-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install Hatch
run: |
pip install --upgrade hatch
- name: Check for API breaking changes (griffe)
run: |
# Use griffe to check for breaking changes against the target branch (mainline)
echo "🔍 Running griffe check command: hatch run docs:check-api-breaks --against origin/${{ github.base_ref }}"
hatch run docs:check-api-breaks --against origin/${{ github.base_ref }}
continue-on-error: true
id: breaking-changes-check
- name: Show breaking changes details
if: steps.breaking-changes-check.outcome == 'failure'
run: |
echo "🚨 Breaking changes to existing interfaces were detected! If these changes are intentional, please mark your commit as a breaking change and provide details in the commit message. Here are the details:"
echo "🔍 Running verbose griffe check command: hatch run docs:check-api-breaks --against origin/${{ github.base_ref }} --verbose"
hatch run docs:check-api-breaks --against origin/${{ github.base_ref }} --verbose
- name: Generate baseline API snapshot from base branch
run: |
echo "📊 Generating baseline API snapshot from base branch: ${{ github.base_ref }}"
hatch run docs:generate-api-snapshot /tmp/baseline_api_snapshot.json ${{ github.base_ref }}
- name: Validate API snapshot against baseline
run: |
echo "📊 Validating current API against baseline snapshot from ${{ github.base_ref }}..."
hatch run docs:validate-api-snapshot /tmp/baseline_api_snapshot.json
continue-on-error: true
id: snapshot-comparison
- name: Fail if breaking changes found
if: steps.breaking-changes-check.outcome == 'failure'
run: |
echo "❌ Breaking API changes detected. Please review the changes above."
echo "If these changes are intentional, please mark your commit as a breaking change and provide details in the commit message."
exit 1
- name: Fail if API changes found
if: steps.snapshot-comparison.outcome == 'failure'
run: |
echo "❌ API changes detected compared to baseline from ${{ github.base_ref }}."
echo "If these changes are intentional:"
echo " 1. Review the changes above"
echo " 2. Ensure your commit message follows conventional commit format"
echo " 3. Mark your commit as 'feat' for new features or 'fix' for bug fixes"
echo " 4. Provide details about the API changes in the commit message"
exit 1
- name: Success message
if: steps.breaking-changes-check.outcome == 'success' && steps.snapshot-comparison.outcome == 'success'
run: |
echo "✅ No API changes detected. All checks passed!"