-
Notifications
You must be signed in to change notification settings - Fork 29
60 lines (58 loc) · 2.02 KB
/
update-visual-snapshots.yml
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
56
57
58
59
60
# When the comment with the text "/update-snapshots" is added to a PR rebuild
# all the visual snapshots for playwright tests and push them to the PR branch
name: Update Visual Snapshots
on:
# Run any time any issue/PR has a new comment
issue_comment:
types: [created]
jobs:
slash_command:
name: slash command
# This job will only run if the comment was on a pull requests and matches the slash command
if: ${{ github.event.issue.pull_request && github.event.comment.body == '/update-snapshots'}}
# Common with standard build
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./inst/editor
steps:
# Checkout with personal TOKEN
# and hop on the PR branch
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_ACTION_TOKEN }}
- name: Get Branch
id: getbranch
run: |
branch=$(\
curl \
-H 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
https://github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} \
| jq -r '.head.ref')
echo "::set-output name=branch::$branch"
- name: Fetch Branch
run: git fetch
- name: Checkout Branch
run: git checkout ${{ steps.getbranch.outputs.branch }}
# Continue with standard build
- uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Install JS dependencies
working-directory: ./inst/editor
run: yarn install
shell: bash
- name: Install Playwright Browsers
run: npx playwright install --with-deps
# Update the snapshots
- name: Update snapshots
run: yarn update-visual-snapshots
# Run build to fix the environment variables
- name: Rebuild main bundle
run: yarn prod
# Commit the changes
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update Snapshots