main
 1name: CI
 2on:
 3  pull_request:
 4    branches:
 5      - main
 6      - next
 7
 8jobs:
 9  detect_breaking_changes:
10    runs-on: 'ubuntu-latest'
11    name: detect-breaking-changes
12    if: github.repository == 'openai/openai-python'
13    steps:
14      - name: Calculate fetch-depth
15        run: |
16          echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV
17
18      - uses: actions/checkout@v4
19        with:
20          # Ensure we can check out the pull request base in the script below.
21          fetch-depth: ${{ env.FETCH_DEPTH }}
22
23      - name: Install Rye
24        run: |
25          curl -sSf https://rye.astral.sh/get | bash
26          echo "$HOME/.rye/shims" >> $GITHUB_PATH
27        env:
28          RYE_VERSION: '0.44.0'
29          RYE_INSTALL_OPTION: '--yes'
30      - name: Install dependencies
31        run: |
32          rye sync --all-features
33      - name: Detect removed symbols
34        run: |
35          rye run python scripts/detect-breaking-changes.py "${{ github.event.pull_request.base.sha }}"
36
37      - name: Detect breaking changes
38        run: |
39          # Try to check out previous versions of the breaking change detection script. This ensures that
40          # we still detect breaking changes when entire files and their tests are removed.
41          git checkout "${{ github.event.pull_request.base.sha }}" -- ./scripts/detect-breaking-changes 2>/dev/null || true
42          ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }}