Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,33 @@ jobs:
- name: Run unit tests
id: unit-tests
run: npm run test:quiet


- name: Check DTS API compatibility
if: github.event_name == 'pull_request'
shell: bash
run: |
BASE_REF="origin/${{ github.base_ref }}"
SNAP_FILE="tests/__snapshots__/dts-snapshot.test.ts.snap"

# Skip if snapshot file is new (not in base branch yet)
if ! git show "$BASE_REF:$SNAP_FILE" > /dev/null 2>&1; then
echo "Snapshot file is new, skipping API compatibility check."
exit 0
fi

# Check if snapshot file changed compared to base branch
if git diff --name-only "$BASE_REF"...HEAD | grep -q "$SNAP_FILE"; then
PR_TITLE="${{ github.event.pull_request.title }}"
if [[ "$PR_TITLE" != *"[break]"* ]]; then
echo "::error::DTS API breaking change detected! The snapshot file changed but the PR title does not contain [break]."
echo "::error::If this change is intentional, add [break] to your PR title."
exit 1
fi
echo "API change detected and [break] tag found in PR title."
else
echo "No DTS API changes detected."
fi

- name: Run E2E tests
id: e2e-tests
uses: ./.github/actions/run-e2e-tests
Expand Down
Loading
Loading