@@ -2,17 +2,16 @@ name: Storybook
2
2
3
3
on :
4
4
push :
5
- branches :
6
- - master
7
- - develop
8
- pull_request :
9
5
branches-ignore :
10
6
- l10n_develop
11
7
12
8
jobs :
13
9
build :
14
10
runs-on : ubuntu-latest
15
11
12
+ env :
13
+ NODE_OPTIONS : " --max_old_space_size=7168"
14
+
16
15
steps :
17
16
18
17
with :
@@ -36,21 +35,34 @@ jobs:
36
35
run : pnpm --filter misskey-js build
37
36
- name : Build storybook
38
37
run : pnpm --filter frontend build-storybook
38
+ - name : Publish to Chromatic
39
+ if : github.ref == 'refs/heads/master'
40
+ run : pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static
39
41
env :
40
- NODE_OPTIONS : " --max_old_space_size=7168 "
42
+ CHROMATIC_PROJECT_TOKEN : ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
41
43
- name : Publish to Chromatic
44
+ if : github.ref != 'refs/heads/master'
42
45
id : chromatic
43
- uses : chromaui/action@v1
44
- with :
45
- exitOnceUploaded : true
46
- projectToken : ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
47
- storybookBuildDir : storybook-static
48
- workingDir : packages/frontend
49
- - name : Compare on Chromatic
50
- if : github.event_name == 'pull_request_target'
51
- run : pnpm --filter frontend chromatic -d storybook-static --exit-once-uploaded --patch-build ${{ github.head_ref }}...${{ github.base_ref }}
46
+ run : |
47
+ CHROMATIC_PARAMETER="$(node packages/frontend/.storybook/changes.js $(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }} HEAD | xargs))"
48
+ if [ "$CHROMATIC_PARAMETER" = " --skip" ]; then
49
+ echo "skip=true" >> $GITHUB_OUTPUT
50
+ fi
51
+ pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static $(echo "$CHROMATIC_PARAMETER")
52
52
env :
53
53
CHROMATIC_PROJECT_TOKEN : ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
54
+ - name : Notify that Chromatic will skip testing
55
+
56
+ if : github.ref != 'refs/heads/master' && steps.chromatic.outputs.skip == 'true'
57
+ with :
58
+ github-token : ${{ secrets.GITHUB_TOKEN }}
59
+ script : |
60
+ github.rest.repos.createCommitComment({
61
+ owner: context.repo.owner,
62
+ repo: context.repo.repo,
63
+ commit_sha: context.sha,
64
+ body: 'Chromatic will skip testing but you may still have to [review the changes on Chromatic](https://www.chromatic.com/pullrequests?appId=6428f7d7b962f0b79f97d6e4).'
65
+ })
54
66
- name : Upload Artifacts
55
67
uses : actions/upload-artifact@v3
56
68
with :
0 commit comments