| 1 |
name: CI |
| 2 |
on: |
| 3 |
pull_request: |
| 4 |
branches: |
| 5 |
- main |
| 6 |
- next |
| 7 |
|
| 8 |
jobs: |
| 9 |
detect_breaking_changes: |
| 10 |
runs-on: 'ubuntu-latest' |
| 11 |
name: detect-breaking-changes |
| 12 |
if: github.repository == 'anthropics/anthropic-sdk-go' |
| 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@v6 |
| 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: Setup go |
| 24 |
uses: actions/setup-go@v5 |
| 25 |
with: |
| 26 |
go-version-file: ./go.mod |
| 27 |
|
| 28 |
- name: Detect breaking changes |
| 29 |
run: | |
| 30 |
# Try to check out previous versions of the breaking change detection script. This ensures that |
| 31 |
# we still detect breaking changes when entire files and their tests are removed. |
| 32 |
git checkout "${{ github.event.pull_request.base.sha }}" -- ./scripts/detect-breaking-changes 2>/dev/null || true |
| 33 |
./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }} |