updates component explorer

This commit is contained in:
Henning Dieterichs
2026-03-11 21:49:09 +01:00
committed by Henning Dieterichs
parent b49670d4a1
commit 5d56633a57
11 changed files with 106 additions and 211 deletions

View File

@@ -54,12 +54,12 @@ jobs:
run: npx playwright install chromium
- name: Capture screenshots
run: npx component-explorer screenshot --project ./test/componentFixtures/component-explorer.json
run: ./node_modules/.bin/component-explorer screenshot --project ./test/componentFixtures/component-explorer.json
- name: Compare screenshots
id: compare
run: |
npx component-explorer screenshot:compare \
./node_modules/.bin/component-explorer screenshot:compare \
--project ./test/componentFixtures \
--report ./test/componentFixtures/.screenshots/report
continue-on-error: true
@@ -92,19 +92,33 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
REPORT="test/componentFixtures/.screenshots/report/report.json"
STATE="success"
if [ -f "$REPORT" ]; then
CHANGED=$(node -e "const r = require('./$REPORT'); console.log(r.summary.added + r.summary.removed + r.summary.changed)")
TITLE="⚠ ${CHANGED} screenshots changed"
BLOCKS_CI=$(node -e "
const r = require('./$REPORT');
const blocking = Object.entries(r.fixtures).filter(([, f]) =>
f.status !== 'unchanged' && (f.labels || []).includes('blocks-ci')
);
if (blocking.length > 0) {
console.log(blocking.map(([name]) => name).join(', '));
}
")
if [ -n "$BLOCKS_CI" ]; then
STATE="failure"
TITLE="❌ ${CHANGED} screenshots changed (blocks CI: ${BLOCKS_CI})"
fi
else
TITLE="✅ Screenshots match"
fi
SHA="${{ github.event.pull_request.head.sha || github.sha }}"
DETAILS_URL="https://hediet-ghartifactpreview.azurewebsites.net/${{ github.repository }}/run/${{ github.run_id }}/component-explorer/___explorer.html?report=./screenshot-report/report.json"
DETAILS_URL="https://hediet-ghartifactpreview.azurewebsites.net/${{ github.repository }}/run/${{ github.run_id }}/component-explorer/___explorer.html?report=./screenshot-report/report.json&search=changed"
gh api "repos/${{ github.repository }}/statuses/$SHA" \
--input - <<EOF || echo "::warning::Could not create commit status (expected for fork PRs)"
{"state":"success","target_url":"$DETAILS_URL","description":"$TITLE","context":"Component Screenshots"}
{"state":"$STATE","target_url":"$DETAILS_URL","description":"$TITLE","context":"Component Screenshots"}
EOF
# - name: Post PR comment