1
1
name : Update Snapshots
2
2
3
3
on :
4
- # Run any time any issue/PR has a new comment
5
4
issue_comment :
6
5
types : [created]
7
6
8
7
jobs :
9
8
slash_command :
10
- name : slash command
11
- # This job will only run if the comment was on a pull requests and matches the slash command
12
- if : ${{ github.event.issue.pull_request && github.event.comment.body == '/update-snapshots'}}
13
- # Common with standard build
14
- timeout-minutes : 60
9
+ name : Slash Command
10
+ if : ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/update-snapshots')}}
15
11
runs-on : ubuntu-latest
16
12
steps :
17
- # Checkout with personal TOKEN
18
- # and hop on the PR branch
19
- - uses : actions/checkout@v3
13
+ - name : Checkout code
14
+ uses : actions/checkout@v3
20
15
with :
21
- fetch-depth : 0
22
- token : ${{ secrets.GH_ACTION_TOKEN }}
23
- - name : Get Branch
24
- id : getbranch
25
- run : |
26
- branch=$(\
27
- curl \
28
- -H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
29
- https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} \
30
- | jq -r '.head.ref')
31
- echo "::set-output name=branch::$branch"
32
- - name : Fetch Branch
33
- run : git fetch
34
- - name : Checkout Branch
35
- run : git checkout ${{ steps.getbranch.outputs.branch }}
36
- # Continue with standard build
16
+ ref : ${{ github.event.pull_request.head.sha }}
17
+ token : ${{ secrets.GITHUB_TOKEN }}
18
+
37
19
- name : Use Node.js
38
20
uses : actions/setup-node@v3
39
21
with :
40
- node-version : 20
22
+ node-version : ' 14'
23
+
41
24
- name : Install dependencies
42
- run : pnpm install
25
+ run : npm install
26
+
43
27
- name : Install Playwright
44
- run : npx playwright install --with-deps
45
- # Update the snapshots
28
+ run : npx playwright install
29
+
46
30
- name : Update snapshots
47
31
run : npx playwright test --update-snapshots --reporter=list
48
- # Commit the changes
49
- - uses : stefanzweifel/git-auto-commit-action@v4
50
- with :
51
- commit_message : Update Snapshots
32
+
33
+ - name : Commit and push updated snapshots
34
+ run : |
35
+ git config --global user.name 'Your Name'
36
+ git config --global user.email 'you@example.com'
37
+ git add .
38
+ git commit -m "Update snapshots"
39
+ git push
0 commit comments