Merge pull request #31470 from backstage/fix-chromatic-forks
Fix Chromatic preview in forks
This commit is contained in:
@@ -64,21 +64,29 @@ jobs:
|
||||
|
||||
- name: Prepare Chromatic Message
|
||||
if: github.event_name == 'pull_request' && steps.chromatic.outputs.url
|
||||
id: prepare-message
|
||||
id: prepareMessage
|
||||
run: |
|
||||
if [ "${{ steps.chromatic.outputs.changeCount }}" = "0" ] || [ -z "${{ steps.chromatic.outputs.changeCount }}" ]; then
|
||||
echo "changes-text=No visual changes detected - [**View build in Chromatic**](${{ steps.chromatic.outputs.buildUrl }})" >> $GITHUB_OUTPUT
|
||||
echo "changesText=No visual changes detected - [**View build in Chromatic**](${{ steps.chromatic.outputs.buildUrl }})" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "changes-text=**${{ steps.chromatic.outputs.changeCount }}** visual changes are waiting for review - [**Review changes in Chromatic**](${{ steps.chromatic.outputs.buildUrl }})" >> $GITHUB_OUTPUT
|
||||
echo "changesText=**${{ steps.chromatic.outputs.changeCount }}** visual changes are waiting for review - [**Review changes in Chromatic**](${{ steps.chromatic.outputs.buildUrl }})" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Post Chromatic Link in PR Comment
|
||||
- name: Post Chromatic Results to Job Summary
|
||||
if: github.event_name == 'pull_request' && steps.chromatic.outputs.url
|
||||
run: |
|
||||
echo "## 🎨 Visual Testing with Chromatic" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- ${{ steps.prepareMessage.outputs.changesText }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- **${{ steps.chromatic.outputs.specCount}}** stories for **${{ steps.chromatic.outputs.componentCount}}** Components - [**Preview changes in Storybook**](${{ steps.chromatic.outputs.storybookUrl }})" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Post Chromatic Link in PR Comment
|
||||
if: github.event_name == 'pull_request' && steps.chromatic.outputs.url && github.event.pull_request.head.repo.full_name == github.repository
|
||||
uses: mshick/add-pr-comment@v2
|
||||
with:
|
||||
message: |
|
||||
## 🎨 Visual Testing with Chromatic
|
||||
|
||||
- ${{ steps.prepare-message.outputs.changes-text }}
|
||||
- ${{ steps.prepareMessage.outputs.changesText }}
|
||||
- **${{ steps.chromatic.outputs.specCount}}** stories for **${{ steps.chromatic.outputs.componentCount}}** Components - [**Preview changes in Storybook**](${{ steps.chromatic.outputs.storybookUrl }})
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user