Skip to content

Commit

Permalink
Fix chromatic workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixTJDietrich committed Aug 10, 2024
1 parent 72d08f0 commit 7041fbe
Showing 1 changed file with 48 additions and 4 deletions.
52 changes: 48 additions & 4 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,75 @@
name: "Chromatic"

on: push
on:
push:
branches:
- develop
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-chromatic
cancel-in-progress: true

permissions:
actions: write
contents: read

jobs:
changed-files:
runs-on: ubuntu-latest
name: changed-files
outputs:
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}
any_changed: ${{ steps.changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files: |
webapp/src/app/**
webapp/.storybook/**
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
ANY_CHANGED: ${{ steps.changed-files.outputs.any_changed }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
echo Did any files change: ${ANY_CHANGED}
done
chromatic:
name: Run Chromatic
runs-on: ubuntu-latest
needs: [changed-files]
if: ${{ needs.changed-files.outputs.any_changed == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./package.json
node-version: 22
- name: Install dependencies
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment.
working-directory: ./webapp
run: npm ci
run: npm install
- name: Run Chromatic
id: chromatic
uses: chromaui/action@latest
with:
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: "develop"
workingDir: webapp
exitZeroOnChanges: true
exitOnceUploaded: true
onlyChanged: true
skip: "dependabot/**"
- name: Publish Summary
run: echo -e "| Results | |\n| --- | --- |\n| Build Results | ${{ steps.chromatic.outputs.buildUrl }} |\n| Storybook Preview | ${{ steps.chromatic.outputs.storybookUrl }} |\n| Component Count | ${{steps.chromatic.outputs.componentCount}} |" >> $GITHUB_STEP_SUMMARY

0 comments on commit 7041fbe

Please sign in to comment.