-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.47 KB
/
update-snapshot.yaml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: snapshot
on:
issue_comment:
types: [edited]
jobs:
update-snapshots:
runs-on: ubuntu-latest
timeout-minutes: 5
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '- [x] Update All Snapshots') }}
container: mcr.microsoft.com/playwright:v1.33.0-focal
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
ref: ${{ github.head_ref }}
- name: Get target branch's head commit info
id: target-pull-request
uses: actions/github-script@v7
with:
script: |
const head = (await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})).data.head;
core.setOutput('ref', head.ref);
core.setOutput('sha', head.sha);
- name: Get Vercel's Alias Preview URL
id: alias-preview-url
uses: justincase-jp/vercel-preview-url-alias@0.3.0
with:
vercel_access_token: ${{ secrets.VERCEL_ACCESS_TOKEN }}
vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }}
fail_when_cancelled: true
commit_sha: ${{ steps.target-pull-request.outputs.sha }}
- name: Checkout target branch
if: steps.alias-preview-url.outputs.status == 'READY'
run:
git config --global --add safe.directory /__w/next-startbootstrap-agency/next-startbootstrap-agency;
git fetch;
git checkout ${{ steps.target-pull-request.outputs.ref }};
- if: steps.alias-preview-url.outputs.status == 'READY'
run: corepack enable
- uses: actions/setup-node@v4
if: steps.alias-preview-url.outputs.status == 'READY'
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install dependencies
if: steps.alias-preview-url.outputs.status == 'READY'
run: pnpm install --ignore-scripts
- name: Update Snapshots
if: steps.alias-preview-url.outputs.status == 'READY'
run: HOME=/root pnpm e2e:upd
env:
BASE_URL: https://${{ steps.alias-preview-url.outputs.preview_url_origin }}
- uses: stefanzweifel/git-auto-commit-action@v5
if: steps.alias-preview-url.outputs.status == 'READY'
with:
commit_message: 'chore: update changed snapshots'