Skip to content

Commit 351cf5c

Browse files
committed
ci(chromatic): modifying chromatic CI workflow to run on master pushings [run-chromatic]
1 parent b366c96 commit 351cf5c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

.github/workflows/chromatic.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@ permissions:
33
contents: read
44

55
on:
6+
push:
7+
branches:
8+
- master # Workflow runs on pushes to the main branch
69
pull_request:
710
types: [opened, reopened, synchronize]
811

912
jobs:
10-
chromatic:
13+
pr-chromatic:
1114
runs-on: ubuntu-22.04
1215
strategy:
1316
matrix:
1417
node-version: [22.18.0]
1518
if: >
16-
contains(github.event.pull_request.title, '[run-chromatic]')
19+
${{ github.event_name == 'pull_request' && contains(github.event.pull_request.title, '[run-chromatic]') }}
1720
steps:
1821
- name: Check if actor is repo admin
1922
id: permission
@@ -51,6 +54,27 @@ jobs:
5154
echo ">>>>GitHub Event Pull Request Head SHA: ${{ github.event.pull_request.head.ref }}"
5255
echo ">>>>Checked out commit: $(git rev-parse HEAD)"
5356
- uses: pnpm/action-setup@v4
57+
- name: Install dependencies
58+
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment.
59+
run: pnpm install
60+
- name: Run Chromatic
61+
uses: chromaui/action@latest
62+
with:
63+
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
64+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
65+
onlyChanged: true
66+
exitZeroOnChanges: false
67+
skip: "dependabot/**"
68+
69+
master-chromatic:
70+
runs-on: ubuntu-22.04
71+
strategy:
72+
matrix:
73+
node-version: [22.18.0]
74+
if: >
75+
${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[run-chromatic]') }}
76+
steps:
77+
- uses: pnpm/action-setup@v4
5478
- name: Install dependencies
5579
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment.
5680
run: pnpm install

0 commit comments

Comments
 (0)