Skip to content

Commit 4819a2e

Browse files
authored
feat(conformance): skip test if breaking change is ack (#3619)
# What does this PR do? if the PR title has `!` or the footer of the commit has `BREAKING CHANGE:`, skip conformance. This is documented in the API leveling proposal Signed-off-by: Charlie Doern <cdoern@redhat.com>
1 parent d167101 commit 4819a2e

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

.github/workflows/conformance.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
branches: [ main ]
1212
pull_request:
1313
branches: [ main ]
14-
types: [opened, synchronize, reopened]
14+
types: [opened, synchronize, reopened, edited]
1515
paths:
1616
- 'docs/static/llama-stack-spec.yaml'
1717
- 'docs/static/llama-stack-spec.html'
@@ -27,21 +27,39 @@ jobs:
2727
check-schema-compatibility:
2828
runs-on: ubuntu-latest
2929
steps:
30-
# Using specific version 4.1.7 because 5.0.0 fails when trying to run this locally using `act`
31-
# This ensures consistent behavior between local testing and CI
3230
- name: Checkout PR Code
3331
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
32+
with:
33+
fetch-depth: 0
34+
35+
# Check if we should skip conformance testing due to breaking changes
36+
- name: Check if conformance test should be skipped
37+
id: skip-check
38+
run: |
39+
PR_TITLE="${{ github.event.pull_request.title }}"
3440
41+
# Skip if title contains "!:" indicating breaking change (like "feat!:")
42+
if [[ "$PR_TITLE" == *"!:"* ]]; then
43+
echo "skip=true" >> $GITHUB_OUTPUT
44+
exit 0
45+
fi
46+
47+
# Get all commits in this PR and check for BREAKING CHANGE footer
48+
git log --format="%B" ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | \
49+
grep -q "BREAKING CHANGE:" && echo "skip=true" >> $GITHUB_OUTPUT || echo "skip=false" >> $GITHUB_OUTPUT
50+
shell: bash
3551
# Checkout the base branch to compare against (usually main)
3652
# This allows us to diff the current changes against the previous state
3753
- name: Checkout Base Branch
54+
if: steps.skip-check.outputs.skip != 'true'
3855
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3956
with:
4057
ref: ${{ github.event.pull_request.base.ref }}
4158
path: 'base'
4259

4360
# Cache oasdiff to avoid checksum failures and speed up builds
4461
- name: Cache oasdiff
62+
if: steps.skip-check.outputs.skip != 'true'
4563
id: cache-oasdiff
4664
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830
4765
with:
@@ -50,20 +68,27 @@ jobs:
5068

5169
# Install oasdiff: https://github.com/oasdiff/oasdiff, a tool for detecting breaking changes in OpenAPI specs.
5270
- name: Install oasdiff
53-
if: steps.cache-oasdiff.outputs.cache-hit != 'true'
71+
if: steps.skip-check.outputs.skip != 'true' && steps.cache-oasdiff.outputs.cache-hit != 'true'
5472
run: |
5573
curl -fsSL https://raw.githubusercontent.com/oasdiff/oasdiff/main/install.sh | sh
5674
cp /usr/local/bin/oasdiff ~/oasdiff
5775
5876
# Setup cached oasdiff
5977
- name: Setup cached oasdiff
60-
if: steps.cache-oasdiff.outputs.cache-hit == 'true'
78+
if: steps.skip-check.outputs.skip != 'true' && steps.cache-oasdiff.outputs.cache-hit == 'true'
6179
run: |
6280
sudo cp ~/oasdiff /usr/local/bin/oasdiff
6381
sudo chmod +x /usr/local/bin/oasdiff
6482
6583
# Run oasdiff to detect breaking changes in the API specification
6684
# This step will fail if incompatible changes are detected, preventing breaking changes from being merged
6785
- name: Run OpenAPI Breaking Change Diff
86+
if: steps.skip-check.outputs.skip != 'true'
6887
run: |
6988
oasdiff breaking --fail-on ERR base/docs/static/llama-stack-spec.yaml docs/static/llama-stack-spec.yaml --match-path '^/v1/'
89+
90+
# Report when test is skipped
91+
- name: Report skip reason
92+
if: steps.skip-check.outputs.skip == 'true'
93+
run: |
94+
echo "Conformance test skipped due to breaking change indicator"

0 commit comments

Comments
 (0)