Skip to content

Commit 25628f4

Browse files
avrabeclaude
andcommitted
feat(ci): add breaking change protocol with branch matching
When rules_wasm_component PRs have breaking changes, create a branch in this repo with the same name. CI automatically detects and tests against matching branches. Features: - Check for matching branch before checkout - Clear logging showing branch resolution - Helpful tips on failure for breaking changes 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ab11214 commit 25628f4

File tree

1 file changed

+69
-8
lines changed

1 file changed

+69
-8
lines changed

.github/workflows/integration-test.yml

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ name: Integration Test
55
# 1. Manually via workflow_dispatch with a rules_ref parameter
66
# 2. Via repository_dispatch from rules_wasm_component PRs
77
# 3. On a schedule to catch breaking changes early
8+
#
9+
# BREAKING CHANGE PROTOCOL:
10+
# When rules_wasm_component has breaking changes, create a branch in this repo
11+
# with the SAME NAME as the rules PR branch. The CI will automatically detect
12+
# and use the matching branch.
13+
#
14+
# Example:
15+
# rules PR branch: feature/new-api
16+
# examples branch: feature/new-api (create this with updated examples)
17+
# CI will test rules:feature/new-api against examples:feature/new-api
818

919
on:
1020
workflow_dispatch:
@@ -40,9 +50,6 @@ jobs:
4050
os: [ubuntu-latest, macos-latest]
4151

4252
steps:
43-
- name: Checkout examples
44-
uses: actions/checkout@v4
45-
4653
- name: Determine rules_wasm_component ref
4754
id: rules-ref
4855
run: |
@@ -63,7 +70,43 @@ jobs:
6370
6471
echo "ref=$REF" >> $GITHUB_OUTPUT
6572
echo "repo=$REPO" >> $GITHUB_OUTPUT
66-
echo "Testing against $REPO@$REF"
73+
74+
- name: Check for matching examples branch
75+
id: examples-branch
76+
run: |
77+
RULES_BRANCH="${{ steps.rules-ref.outputs.ref }}"
78+
79+
echo "══════════════════════════════════════════════════════════"
80+
echo "INTEGRATION TEST BRANCH RESOLUTION"
81+
echo "══════════════════════════════════════════════════════════"
82+
echo "Rules PR branch: $RULES_BRANCH"
83+
echo "Checking examples repo for matching branch..."
84+
echo ""
85+
86+
# Check if a matching branch exists in this repo
87+
if git ls-remote --heads origin "$RULES_BRANCH" | grep -q "$RULES_BRANCH"; then
88+
echo "✅ Found matching branch: $RULES_BRANCH"
89+
echo " Using examples branch: $RULES_BRANCH"
90+
echo ""
91+
echo " This means the rules PR has breaking changes that require"
92+
echo " corresponding updates in the examples repo."
93+
echo "branch=$RULES_BRANCH" >> $GITHUB_OUTPUT
94+
echo "matched=true" >> $GITHUB_OUTPUT
95+
else
96+
echo "ℹ️ No matching branch found: $RULES_BRANCH"
97+
echo " Using examples branch: main"
98+
echo ""
99+
echo " This is expected for non-breaking changes."
100+
echo "branch=main" >> $GITHUB_OUTPUT
101+
echo "matched=false" >> $GITHUB_OUTPUT
102+
fi
103+
104+
echo "══════════════════════════════════════════════════════════"
105+
106+
- name: Checkout examples
107+
uses: actions/checkout@v4
108+
with:
109+
ref: ${{ steps.examples-branch.outputs.branch }}
67110

68111
- name: Checkout rules_wasm_component
69112
uses: actions/checkout@v4
@@ -137,11 +180,29 @@ jobs:
137180
- name: Report success
138181
if: success()
139182
run: |
140-
echo "✅ Integration test PASSED"
141-
echo "Tested against: ${{ steps.rules-ref.outputs.repo }}@${{ steps.rules-ref.outputs.ref }}"
183+
echo "══════════════════════════════════════════════════════════"
184+
echo "✅ INTEGRATION TEST PASSED"
185+
echo "══════════════════════════════════════════════════════════"
186+
echo "Rules: ${{ steps.rules-ref.outputs.repo }}@${{ steps.rules-ref.outputs.ref }}"
187+
echo "Examples: ${{ steps.examples-branch.outputs.branch }}"
188+
if [ "${{ steps.examples-branch.outputs.matched }}" == "true" ]; then
189+
echo ""
190+
echo "Note: Used matching examples branch for breaking changes."
191+
fi
192+
echo "══════════════════════════════════════════════════════════"
142193
143194
- name: Report failure
144195
if: failure()
145196
run: |
146-
echo "❌ Integration test FAILED"
147-
echo "Tested against: ${{ steps.rules-ref.outputs.repo }}@${{ steps.rules-ref.outputs.ref }}"
197+
echo "══════════════════════════════════════════════════════════"
198+
echo "❌ INTEGRATION TEST FAILED"
199+
echo "══════════════════════════════════════════════════════════"
200+
echo "Rules: ${{ steps.rules-ref.outputs.repo }}@${{ steps.rules-ref.outputs.ref }}"
201+
echo "Examples: ${{ steps.examples-branch.outputs.branch }}"
202+
if [ "${{ steps.examples-branch.outputs.matched }}" == "false" ]; then
203+
echo ""
204+
echo "💡 TIP: If this is a breaking change, create a branch in the"
205+
echo " examples repo with the same name: ${{ steps.rules-ref.outputs.ref }}"
206+
echo " Update the examples to work with the new API, then re-run."
207+
fi
208+
echo "══════════════════════════════════════════════════════════"

0 commit comments

Comments
 (0)