Skip to content

chore: add @InternalApi to binary compatibility checks; introduce new PR check to verify no API-breaking changes #1

chore: add @InternalApi to binary compatibility checks; introduce new PR check to verify no API-breaking changes

chore: add @InternalApi to binary compatibility checks; introduce new PR check to verify no API-breaking changes #1

name: API compatibility verification
on:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches: [ main ]
jobs:
api-compat-verification:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check for API compatibility
if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-api-break') }}
run: |

Check failure on line 15 in .github/workflows/api-compat-verification.yml

View workflow run for this annotation

GitHub Actions / API compatibility verification

Invalid workflow file

The workflow is not valid. .github/workflows/api-compat-verification.yml (Line: 15, Col: 14): Unrecognized function: 'failure'. Located at position 1 within expression: failure()
git fetch origin ${{ github.base_ref }} --depth 1 && \
git diff remotes/origin/${{ github.base_ref }} --numstat "*.api" | awk '
BEGIN { s = 0 }
# git diff numstat shows lines deleted in field 2, hence sum up field 2 across all items
{ s += $2 }
# exit with the number of lines deleted as the result code so that `if ${{ failure() }}` works below
END { exit s }
'
- name: Error message
if: ${{ failure() }}
run: |
echo "::error ::This change modifies the public API in a way that may be backwards-incompatible. Carefully"
echo "::error ::review this pull request and either:
echo "::error ::* Revert the changes which caused the API incompatibility –or–"
echo "::error ::* Add the 'acknowledge-api-break' label to this PR (in rare cases warranting an API breakage)"
exit 1