Skip to content

tmp: break rainbow preset #10

tmp: break rainbow preset

tmp: break rainbow preset #10

Workflow file for this run

name: "Visual Regression Test"
on:
issue_comment:
types: [created]
jobs:
vrt:
# Only run when a "/vrt" comment is posted on a PR
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/vrt' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
statuses: write
checks: write # Required for creating and updating check runs
steps:
# Create a required check to block merging until VRT passes
- name: Create Required Check
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
// Create initial check run
const check = await github.rest.checks.create({
owner,
repo,
name: 'VRT Status',
head_sha: context.sha,
status: 'in_progress',
output: {
title: 'VRT Required',
summary: 'Visual Regression Test is now required for this PR'
}
});
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for Chromatic to access git history
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: "**/package-lock.json"
- name: Install dependencies
run: npm ci
- name: Build @vfx-js/core
run: npm --workspace @vfx-js/core run build
# Run Chromatic VRT
- name: Run Chromatic
id: chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
workingDir: packages/storybook # Specify Storybook directory in workspace
# Update check result and post comment
- name: Update Check Result and Comment
if: always() # Run this step even if previous steps fail
uses: actions/github-script@v7
with:
script: |-
const { owner, repo } = context.repo;
const conclusion = '${{ steps.chromatic.outcome }}' === 'success' ? 'success' : 'failure';
const buildUrl = '${{ steps.chromatic.outputs.buildUrl }}' || 'No build URL available';
const storybookUrl = '${{ steps.chromatic.outputs.storybookUrl }}' || 'No storybook URL available';
// Update check run
await github.rest.checks.create({
owner,
repo,
name: 'VRT Status',
head_sha: context.sha,
status: 'completed',
conclusion: conclusion,
output: {
title: conclusion === 'success' ? 'VRT Passed' : 'VRT Failed',
summary: conclusion === 'success'
? 'Visual Regression Test passed successfully'
: 'Visual Regression Test failed - please check the results'
}
});
// Create comment content with emojis and links
const commentBody = `## Visual Regression Test Results ${conclusion === 'success' ? '✅' : '❌'}
${conclusion === 'success'
? '🎉 All visual tests have passed!'
: '⚠️ Some visual changes were detected. Please review the changes.'}
🔍 **Test Results:**
- Build details: [View on Chromatic](${buildUrl})
- Storybook preview: [View Storybook](${storybookUrl})
${conclusion !== 'success'
? '\n⚡ To re-run the test, comment `/vrt` on this PR.'
: ''}`;
// Post comment to PR
await github.rest.issues.createComment({
owner,
repo,
issue_number: context.issue.number,
body: commentBody
});