@@ -24,22 +24,39 @@ jobs:
2424 with :
2525 node-version-file : ' .nvmrc'
2626
27- - name : Install dependencies
28- run : npm install
27+ - name : Get common ancestor commit
28+ run : |
29+ git fetch origin main
30+ common_ancestor=$(git merge-base "${{ github.sha }}" origin/main)
31+ echo "COMMIT_HASH=$common_ancestor" >> "$GITHUB_ENV"
2932
30- - name : Run Reassure baseline tests
31- run : npx reassure --baseline
33+ - name : Clean up deleted files
34+ run : |
35+ DELETED_FILES=$(git diff --name-only --diff-filter=D "$COMMIT_HASH" "${{ github.sha }}")
36+ for file in $DELETED_FILES; do
37+ if [ -n "$file" ]; then
38+ rm -f "$file"
39+ echo "Deleted file: $file"
40+ fi
41+ done
3242
33- - name : Checkout PR head ref
43+ - name : Run Reassure baseline tests
44+ shell : bash
3445 run : |
35- git fetch origin ${{ github.event.pull_request.head.ref }} --no-tags --depth=1
36- git switch --force --detach ${{ github.event.pull_request.head.ref }}
37-
38- - name : Reinstall dependencies
39- run : npm install --force
46+ BASELINE_BRANCH=${BASELINE_BRANCH:="main"}
47+ git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1
48+ git switch "$BASELINE_BRANCH"
49+ npm install --force || (rm -rf node_modules && npm install --force)
50+ NODE_OPTIONS=--experimental-vm-modules npx reassure --baseline
4051
4152 - name : Run Reassure delta tests
42- run : npx reassure --branch
53+ shell : bash
54+ run : |
55+ git switch --force --detach -
56+ git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
57+ git checkout --ours .
58+ npm install --force || (rm -rf node_modules && npm install --force)
59+ NODE_OPTIONS=--experimental-vm-modules npx reassure --branch
4360
4461 - name : Validate output.json
4562 id : validateReassureOutput
0 commit comments