Update verify_chromatic.yml

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2025-09-19 09:46:40 +01:00
parent 15ac8dc8ae
commit 3407916506
+22 -27
View File
@@ -57,31 +57,7 @@ jobs:
projectToken: chpt_dab72dc0f97d55b
storybookBuildDir: dist-storybook
onlyChanged: true
- name: Extract Chromatic Details
if: github.event_name == 'pull_request' && steps.chromatic.outputs.url
id: extract-details
run: |
# Try to extract change count from Chromatic logs
# This is a best-effort approach as the exact log format may vary
echo "Extracting Chromatic details from logs..."
# Set default values
CHANGES_COUNT="Unknown"
STORIES_COUNT="Unknown"
# Try to find change count in various log patterns
if [ -f "$GITHUB_WORKSPACE/chromatic-output.log" ]; then
CHANGES_COUNT=$(grep -oP '(\d+)\s+changes?' "$GITHUB_WORKSPACE/chromatic-output.log" | head -1 | grep -oP '\d+' || echo "Unknown")
STORIES_COUNT=$(grep -oP '(\d+)\s+stories?' "$GITHUB_WORKSPACE/chromatic-output.log" | head -1 | grep -oP '\d+' || echo "Unknown")
fi
# Output the extracted values
echo "changes-count=$CHANGES_COUNT" >> $GITHUB_OUTPUT
echo "stories-count=$STORIES_COUNT" >> $GITHUB_OUTPUT
echo "Changes detected: $CHANGES_COUNT"
echo "Stories affected: $STORIES_COUNT"
externals: packages/ui/**/*.css
- name: Post Chromatic Link in PR Comment
if: github.event_name == 'pull_request' && steps.chromatic.outputs.url
@@ -99,8 +75,27 @@ jobs:
| [**Live Storybook**](${{ steps.chromatic.outputs.storybookUrl }}) | Browse the interactive component library |
### 📊 Build Summary
- **Changes detected**: ${{ steps.extract-details.outputs.changes-count }}
- **Stories affected**: ${{ steps.extract-details.outputs.stories-count }}
- **Changes detected**: ${{ steps.chromatic.outputs.changeCount }}
- **Actual capture count**: ${{ steps.chromatic.outputs.actualCaptureCount }}
---
### 🔧 All Available Chromatic Outputs
| Output | Value | Description |
|--------|-------|-------------|
| `url` | `${{ steps.chromatic.outputs.url }}` | An alias for the build URL. |
| `buildUrl` | `${{ steps.chromatic.outputs.buildUrl }}` | The build URL. |
| `storybookUrl` | `${{ steps.chromatic.outputs.storybookUrl }}` | The Storybook preview URL for your current branch / Pull Request. |
| `code` | `${{ steps.chromatic.outputs.code }}` | The exit code for the current run of the Chromatic CLI. |
| `actualCaptureCount` | `${{ steps.chromatic.outputs.actualCaptureCount }}` | The number of captured snapshots. |
| `changeCount` | `${{ steps.chromatic.outputs.changeCount }}` | The number of tests with visual changes, including any inherited changes (e.g., due to TurboSnap). |
| `componentCount` | `${{ steps.chromatic.outputs.componentCount }}` | The number of components in the published Storybook. |
| `errorCount` | `${{ steps.chromatic.outputs.errorCount }}` | The number of tests with error(s), including any inherited errors (e.g., due to TurboSnap). |
| `inheritedCaptureCount` | `${{ steps.chromatic.outputs.inheritedCaptureCount }}` | The number of inherited (not captured) snapshots (e.g., due to TurboSnap). |
| `interactionTestFailuresCount` | `${{ steps.chromatic.outputs.interactionTestFailuresCount }}` | The number of stories with interaction test failures. |
| `specCount` | `${{ steps.chromatic.outputs.specCount }}` | The number of stories in the published Storybook. |
| `testCount` | `${{ steps.chromatic.outputs.testCount }}` | The number of tests on the build. |
---
*This comment is automatically updated when visual tests run.*