Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Use pull_request instead of pull_request_target in compatibility action #2883

Merged
merged 11 commits into from
Feb 9, 2023
52 changes: 52 additions & 0 deletions .github/workflows/check_compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Check compatibility

on:
pull_request:

jobs:
check-interface-compatibility:
aahung marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest

steps:
- name: Checkout the PR
uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Extract PR public interfaces
run: |
make init
bin/public_interface.py extract > "${{ runner.temp }}"/interfaces.new.json

- name: Backup PR bin/public_interface.py
run: |
# Keep a copy of bin/public_interface.py
# So we are using the same bin/public_interface.py to process old/new codebase.
cp bin/public_interface.py "${{ runner.temp }}"/public_interface.py

- name: Checkout the base
uses: actions/checkout@v3
with:
ref: "${{ github.base_ref }}"

- name: Extract original public interfaces
run: |
make init
# Recover bin/public_interface.py
cp "${{ runner.temp }}"/public_interface.py bin/public_interface.py
bin/public_interface.py extract > "${{ runner.temp }}"/interfaces.original.json

- name: Detect compatibility breaking changes
id: detect
run: |
exit_code=0
output=$(bin/public_interface.py check "${{ runner.temp }}"/interfaces.original.json "${{ runner.temp }}"/interfaces.new.json) || exit_code=$?
echo "$output"

if [ "$exit_code" -ne 0 ]; then
# Show the output in job summary and fail the workflow
echo "$output" >> $GITHUB_STEP_SUMMARY
exit "$exit_code"
fi
83 changes: 0 additions & 83 deletions .github/workflows/check_interface_compatibility.yml

This file was deleted.