File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed
Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ name : OpenAPI Spec Diff Check
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - master
8+ - main
9+
10+ # Cancel in-progress runs for the same PR/branch
11+ concurrency :
12+ group : ${{ github.workflow }}-${{ github.ref }}
13+ cancel-in-progress : true
14+
15+ jobs :
16+ test-branch-logic :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Checkout code
20+ uses : actions/checkout@v4
21+
22+ - name : Run branch logic unit tests
23+ run : ./scripts/api-diff/api-diff.test.sh
24+
25+ api-diff :
26+ runs-on : ubuntu-latest
27+ needs : test-branch-logic
28+ permissions :
29+ contents : read
30+ pull-requests : write
31+
32+ steps :
33+ - name : Checkout code
34+ uses : actions/checkout@v4
35+ with :
36+ fetch-depth : 0
37+
38+ - name : Pull oasdiff Docker image
39+ run : docker pull tufin/oasdiff:latest
40+
41+ - name : Make script executable
42+ run : chmod +x scripts/api-diff/api-diff.sh
43+
44+ - name : Run API diff check
45+ run : ./scripts/api-diff/api-diff.sh
Original file line number Diff line number Diff line change @@ -26,6 +26,18 @@ for arg in "$@"; do
2626 fi
2727done
2828
29+ # If --fail-on-breaking not explicitly set, determine based on branch name
30+ if [ " $FAIL_ON_BREAKING " = false ]; then
31+ CURRENT_BRANCH=$( git branch --show-current 2> /dev/null || echo " " )
32+ if [[ " $CURRENT_BRANCH " == * breaking* ]]; then
33+ echo " Branch '$CURRENT_BRANCH ' contains 'breaking', allowing breaking changes"
34+ FAIL_ON_BREAKING=false
35+ else
36+ echo " Branch '$CURRENT_BRANCH ' does not contain 'breaking', failing on breaking changes"
37+ FAIL_ON_BREAKING=true
38+ fi
39+ fi
40+
2941echo " Starting API diff check..."
3042
3143# Ensure we're in the repo root
You can’t perform that action at this time.
0 commit comments