diff --git a/.github/workflows/run-tests-example-apps.yml b/.github/workflows/run-tests-example-apps.yml index b73c5c854..9584b8b58 100644 --- a/.github/workflows/run-tests-example-apps.yml +++ b/.github/workflows/run-tests-example-apps.yml @@ -2,11 +2,20 @@ name: Run tests for example apps on: workflow_dispatch: + inputs: + update-screenshots: + description: "Update screenshots" + required: false + default: "false" + # TODO: Enable this when we test this workflow manually # pull_request: # branches: # - develop +permissions: + contents: write + jobs: run-tests-example-apps: runs-on: ubuntu-latest @@ -30,4 +39,19 @@ jobs: run: npm install -g http-server - name: Run tests - run: cd examples/tests && npm test \ No newline at end of file + if: inputs.update-screenshots == 'false' + run: cd examples/tests && npm test + + - name: Run tests with updated screenshots + if: inputs.update-screenshots == 'true' + run: cd examples/tests && npm test -- --update-snapshots + + + - name: Upload screenshots + if: inputs.update-screenshots == 'true' + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m 'ci: update screenshots' --allow-empty + git push \ No newline at end of file