An open source design system that's fully customizable and agent ready
TypeScript
Fix missing playwright package during pr-* workflows (#238)
Cindy Zhang4d43df9184ae
diff --git a/.github/scripts/generate-pr-comment.js b/.github/scripts/generate-pr-comment.jsindex 8e194d75b2..a1f0d9f5ff 100644--- a/.github/scripts/generate-pr-comment.js+++ b/.github/scripts/generate-pr-comment.js@@ -2,7 +2,7 @@/*** @description Generates and posts PR comment with analysis results and embedded screenshots- * @input --analysis <file> --a11y <file> --screenshots <file> --screenshot-urls <file> --storybook-url <url> --run-url <url>+ * @input --analysis <file> --a11y <file> --screenshots <file> --screenshot-urls <file> --storybook-url <url> --run-url <url> [--pending]* @output Formatted markdown comment body to stdout*/@@ -22,6 +22,7 @@ const runUrl = getArg('run-url') || '';const prNumber = getArg('pr-number') || '';const storybookUrl = getArg('storybook-url') || '';const sandboxUrl = getArg('sandbox-url') || '';+const pending = args.includes('--pending');// Read analysis resultslet analysis = { newComponents: [], modifiedComponents: [], componentStats: {}, totalBundle: {} };@@ -215,9 +216,13 @@ if (runUrl) footerLinks.push(`[View full report](${runUrl})`);const footerLinksStr = footerLinks.length > 0 ? ` | ${footerLinks.join(' | ')}` : '';// Build the full comment+const pendingNotice = pending+ ? `> ⏳ Preview links may take up to 1 minute to go live. Screenshots and accessibility audit are still running...\n\n`+ : '';+const body = `## PR Analysis Report-${storybookSection}${sandboxSection}${componentSection || '_No new or modified components detected._\n\n'}+${pendingNotice}${storybookSection}${sandboxSection}${componentSection || '_No new or modified components detected._\n\n'}${bundleSection}${a11ySection}${screenshotSection}diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex a47db61d5d..30f2e58acc 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -82,15 +82,22 @@ jobs:- name: Build Storybookrun: yarn workspace @xds/storybook build+ - name: Compute short hash+ id: hash+ run: |+ COMMIT_HASH="${{ github.event.pull_request.head.sha }}"+ echo "short_hash=${COMMIT_HASH:0:7}" >> $GITHUB_OUTPUT+- name: Build Sandboxrun: yarn workspace @xds/sandbox buildcontinue-on-error: true+ env:+ SANDBOX_BASE_PATH: /${{ steps.hash.outputs.short_hash }}/sandbox- name: Compute URLsid: urlsrun: |- COMMIT_HASH="${{ github.event.pull_request.head.sha }}"- SHORT_HASH="${COMMIT_HASH:0:7}"+ SHORT_HASH="${{ steps.hash.outputs.short_hash }}"REPO_NAME="${{ github.event.repository.name }}"REPO_OWNER="${{ github.repository_owner }}"@@ -112,9 +119,9 @@ jobs:mkdir -p deploy/${SHORT_HASH}cp -r apps/storybook/dist/* deploy/${SHORT_HASH}/- if [ -d "apps/sandbox/dist" ]; then+ if [ -d "apps/sandbox/out" ]; thenmkdir -p deploy/${SHORT_HASH}/sandbox- cp -r apps/sandbox/dist/* deploy/${SHORT_HASH}/sandbox/+ cp -r apps/sandbox/out/* deploy/${SHORT_HASH}/sandbox/fitouch deploy/.nojekyll@@ -141,8 +148,79 @@ jobs:path: analysis.jsonretention-days: 1+ # Post PR comment with preview links + analysis as soon as build finishes+ # Does NOT wait for test, screenshots, or a11y — those update the comment later+ pr-comment:+ needs: [build]+ runs-on: ubuntu-latest+ steps:+ - name: Checkout+ uses: actions/checkout@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: 22++ - name: Download analysis artifact+ uses: actions/download-artifact@v4+ with:+ name: pr-analysis++ - name: Generate PR comment+ run: |+ RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"++ echo '{"components":{},"summary":{"componentsAudited":0,"totalViolations":0}}' > a11y-report.json++ COMMENT_BODY=$(node .github/scripts/generate-pr-comment.js \+ --analysis analysis.json \+ --a11y a11y-report.json \+ --storybook-url "${{ needs.build.outputs.storybook_url }}" \+ --sandbox-url "${{ needs.build.outputs.sandbox_url }}" \+ --run-url "$RUN_URL" \+ --pr-number "${{ github.event.pull_request.number }}" \+ --pending)++ echo "$COMMENT_BODY" > pr-comment.md++ - name: Comment on PR+ uses: actions/github-script@v7+ with:+ script: |+ const fs = require('fs');+ const body = fs.readFileSync('pr-comment.md', 'utf8');+ const prNumber = ${{ github.event.pull_request.number }};++ const { data: comments } = await github.rest.issues.listComments({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: prNumber,+ });++ const botComment = comments.find(comment =>+ comment.user.type === 'Bot' &&+ comment.body.includes('PR Analysis Report')+ );++ if (botComment) {+ await github.rest.issues.updateComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ comment_id: botComment.id,+ body: body+ });+ } else {+ await github.rest.issues.createComment({+ owner: context.repo.owner,+ repo: context.repo.repo,+ issue_number: prNumber,+ body: body+ });+ }+# Capture component screenshots and videos (parallel with a11y)- # Skipped when no components changed. No yarn install needed.+ # Skipped when no components changed.pr-screenshots:needs: [build, check-components]if: needs.check-components.outputs.has_components == 'true'@@ -155,6 +233,7 @@ jobs:uses: actions/setup-node@v4with:node-version: 22+ cache: 'yarn'- name: Download analysis artifactuses: actions/download-artifact@v4@@ -168,7 +247,7 @@ jobs:path: apps/storybook/dist- name: Install Playwright- run: npx playwright install chromium+ run: yarn install --frozen-lockfile && npx playwright install chromium- name: Install ffmpeg for video conversionrun: sudo apt-get update && sudo apt-get install -y ffmpeg@@ -232,7 +311,7 @@ jobs:retention-days: 30# Accessibility audit (parallel with screenshots)- # Skipped when no components changed. No yarn install needed.+ # Skipped when no components changed.pr-a11y:needs: [build, check-components]if: needs.check-components.outputs.has_components == 'true'@@ -245,6 +324,7 @@ jobs:uses: actions/setup-node@v4with:node-version: 22+ cache: 'yarn'- name: Download analysis artifactuses: actions/download-artifact@v4@@ -258,7 +338,7 @@ jobs:path: apps/storybook/dist- name: Install Playwright- run: npx playwright install chromium+ run: yarn install --frozen-lockfile && npx playwright install chromium- name: Run accessibility auditrun: |@@ -275,11 +355,10 @@ jobs:path: a11y-report.jsonretention-days: 1- # Post PR comment with results- # Waits for test to pass. Runs even when screenshots/a11y are skipped.- pr-comment:- needs: [test, build, check-components, pr-screenshots, pr-a11y]- if: always() && needs.test.result == 'success' && needs.build.result == 'success'+ # Update PR comment with screenshots + a11y results once they're ready+ pr-comment-update:+ needs: [build, check-components, pr-screenshots, pr-a11y]+ if: always() && needs.build.result == 'success' && needs.check-components.outputs.has_components == 'true'runs-on: ubuntu-lateststeps:- name: Checkout@@ -308,7 +387,7 @@ jobs:with:name: a11y-report- - name: Generate PR comment+ - name: Generate updated PR commentrun: |RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"@@ -337,7 +416,7 @@ jobs:echo "$COMMENT_BODY" > pr-comment.md- - name: Comment on PR+ - name: Update PR commentuses: actions/github-script@v7with:script: |diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.ymlindex d4b8e9210c..a4dd23ccf9 100644--- a/.github/workflows/deploy.yml+++ b/.github/workflows/deploy.yml@@ -1,6 +1,6 @@# Deploy Storybook to GitHub Pages# Only runs on push to main — simple and sequential: test → deploy-name: Deploy Storybook to Pages+name: Deployon:push:@@ -55,9 +55,15 @@ jobs:- name: Build Storybookrun: yarn workspace @xds/storybook build+ - name: Compute short hash+ id: hash+ run: echo "short_hash=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT+- name: Build Sandboxrun: yarn workspace @xds/sandbox buildcontinue-on-error: true+ env:+ SANDBOX_BASE_PATH: /${{ steps.hash.outputs.short_hash }}/sandbox- name: Prepare deploymentrun: |@@ -68,9 +74,9 @@ jobs:mkdir -p deploy/${SHORT_HASH}cp -r apps/storybook/dist/* deploy/${SHORT_HASH}/- if [ -d "apps/sandbox/dist" ]; then+ if [ -d "apps/sandbox/out" ]; thenmkdir -p deploy/${SHORT_HASH}/sandbox- cp -r apps/sandbox/dist/* deploy/${SHORT_HASH}/sandbox/+ cp -r apps/sandbox/out/* deploy/${SHORT_HASH}/sandbox/ficat > deploy/index.html << EOFdiff --git a/packages/core/src/Button/XDSButton.tsx b/packages/core/src/Button/XDSButton.tsxindex 2b88326f96..bbe5fc2f22 100644--- a/packages/core/src/Button/XDSButton.tsx+++ b/packages/core/src/Button/XDSButton.tsx@@ -1,6 +1,6 @@/*** @file XDSButton.tsx- * @input Uses React forwardRef, ButtonHTMLAttributes, ReactNode+ * @input Uses React, forwardRef, ButtonHTMLAttributes, ReactNode* @output Exports XDSButton component, XDSButtonProps, XDSButtonVariant types* @position Core implementation; consumed by index.ts, tested by XDSButton.test.tsx*