File tree 1 file changed +31
-9
lines changed
1 file changed +31
-9
lines changed Original file line number Diff line number Diff line change 3
3
issue_comment :
4
4
types : [created]
5
5
jobs :
6
- vrt :
7
- # Trigger by PullRequest comments
6
+ chromatic :
8
7
if : ${{ github.event.issue.pull_request && github.event.comment.body == '/vrt' }}
9
8
runs-on : ubuntu-latest
9
+ permissions :
10
+ pull-requests : write
11
+ statuses : write
10
12
steps :
11
- - name : Get PR details
13
+ - name : Set pending status
12
14
uses : actions/github-script@v7
13
- id : get-pr
14
15
with :
15
16
script : |
16
17
const { owner, repo } = context.repo;
17
- const pr = await github.rest.pulls.get({
18
- owner,
19
- repo,
20
- pull_number: context.issue.number
18
+ await github.rest.repos.createCommitStatus({
19
+ owner,
20
+ repo,
21
+ sha: context.sha,
22
+ state: 'pending',
23
+ context: 'VRT',
24
+ description: 'VRT is running'
21
25
});
22
- return pr.data;
23
26
- name : Checkout repository
24
27
uses : actions/checkout@v4
25
28
with :
33
36
- name : Install dependencies
34
37
run : npm ci
35
38
- name : Publish to Chromatic
39
+ id : chromatic
36
40
uses : chromaui/action@latest
37
41
with :
38
42
projectToken : ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
43
+ workingDir : packages/storybook
44
+ buildScriptName : build-storybook
45
+ - name : Update status
46
+ if : always()
47
+ uses : actions/github-script@v7
48
+ with :
49
+ script : |-
50
+ const { owner, repo } = context.repo;
51
+ await github.rest.repos.createCommitStatus({
52
+ owner,
53
+ repo,
54
+ sha: context.sha,
55
+ state: '${{ steps.chromatic.outcome }}' === 'success' ? 'success' : 'failure',
56
+ context: 'Chromatic',
57
+ description: '${{ steps.chromatic.outcome }}' === 'success'
58
+ ? 'VRT passed'
59
+ : 'VRT failed'
60
+ });
You can’t perform that action at this time.
0 commit comments