Skip to content

Commit d73a528

Browse files
authored
Feat/workflow update screenshots example apps (#849)
* feat: add workflow to update screenshots * fix: add missing step * chore: renamed workflow job * fix: use same workflow
1 parent 1a6e684 commit d73a528

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/run-tests-example-apps.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@ name: Run tests for example apps
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
update-screenshots:
7+
description: "Update screenshots"
8+
required: false
9+
default: "false"
10+
511
# TODO: Enable this when we test this workflow manually
612
# pull_request:
713
# branches:
814
# - develop
915

16+
permissions:
17+
contents: write
18+
1019
jobs:
1120
run-tests-example-apps:
1221
runs-on: ubuntu-latest
@@ -30,4 +39,19 @@ jobs:
3039
run: npm install -g http-server
3140

3241
- name: Run tests
33-
run: cd examples/tests && npm test
42+
if: inputs.update-screenshots == 'false'
43+
run: cd examples/tests && npm test
44+
45+
- name: Run tests with updated screenshots
46+
if: inputs.update-screenshots == 'true'
47+
run: cd examples/tests && npm test -- --update-snapshots
48+
49+
50+
- name: Upload screenshots
51+
if: inputs.update-screenshots == 'true'
52+
run: |
53+
git config --global user.name "github-actions[bot]"
54+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
55+
git add .
56+
git commit -m 'ci: update screenshots' --allow-empty
57+
git push

0 commit comments

Comments
 (0)