Skip to content

Commit 9606877

Browse files
committed
feat: Added action to update the screenshots + process comment
1 parent 44a3017 commit 9606877

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Update screenshot on comment
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
update-screenshots:
7+
name: Update Screenshot
8+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/approve-snapshots')
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
steps:
14+
- uses: xt0rted/pull-request-comment-branch@v3
15+
id: comment-branch
16+
- uses: actions/checkout@v4
17+
if: success()
18+
with:
19+
ref: ${{ steps.comment-branch.outputs.head_ref }}
20+
- name: Comment on PR with Playwright report
21+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
22+
if: ${{ failure() && env.SNAPSHOT_DIFFERENCES == 'true' }}
23+
with:
24+
script: |
25+
const body = `### Updating snapshots. Click [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) to see the status.`;
26+
27+
await github.rest.issues.createComment({
28+
issue_number: context.issue.number,
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
body: body,
32+
});
33+
- name: Install dependencies
34+
run: cd tests && npm ci
35+
- name: Setup Hugo
36+
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
37+
with:
38+
hugo-version: "0.134.2"
39+
extended: true
40+
- name: Install Playwright browsers
41+
run: npx playwright install --with-deps
42+
- name: Run Playwright update snapshots
43+
id: test-visual
44+
run: make tests-update-screenshots

0 commit comments

Comments
 (0)