Repository navigation
55 lines (49 loc) · 1.52 KB
/
Copy pathchromatic.yml
File metadata and controls
55 lines (49 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Chromatic
on:
workflow_dispatch:
inputs:
number:
description: "Pull Request Number"
required: true
jobs:
check:
runs-on: ubuntu-latest
outputs:
branch_name: ${{ fromJson(steps.get_pull.outputs.data).head.label }}
steps:
- id: get_pull
uses: octokit/request-action@v3.x
with:
route: GET /repos/{owner}/{repo}/pulls/{pull_number}
owner: ${{ github.event.repository.owner.login }}
repo: ${{ github.event.repository.name }}
pull_number: ${{ github.event.inputs.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: escape
name: Check for escape chars
run: |
if ${{ contains(fromJson(steps.get_pull.outputs.data).head.label, '"') }}
then
exit 1
else
exit 0
fi
chromatic:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: "refs/pull/${{ github.event.inputs.number }}/head"
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
check-latest: true
- name: Update npm to 11.21.3
run: npm install -g npm@11.21.3
- name: Install dependencies
run: npm ci
- name: Run chromatic on branch
run: npx chromatic --project-token ${{ secrets.CHROMATIC_PROJECT_TOKEN }} --exit-once-uploaded --branch-name="${{ needs.check.outputs.branch_name }}" --only-changed true