From db9d9f71b1151f30c7299c82aa3d659db9704f7f Mon Sep 17 00:00:00 2001 From: Daniel Sil Date: Mon, 19 Feb 2024 17:16:01 +0100 Subject: [PATCH] ci: add update-visual-tests manual job --- .github/workflows/update-visual-tests.yml | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/update-visual-tests.yml diff --git a/.github/workflows/update-visual-tests.yml b/.github/workflows/update-visual-tests.yml new file mode 100644 index 0000000000..f6a3b2a77a --- /dev/null +++ b/.github/workflows/update-visual-tests.yml @@ -0,0 +1,51 @@ +name: Update Visual Tests + +on: + pull_request: + workflow_dispatch: + inputs: + commitMessage: + description: "Commit message for the update" + required: true + default: "chore: update visual tests" + +jobs: + update-visual-tests: + runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.39.0-jammy + steps: + - name: Install git + run: sudo apt-get install git + + - name: Checkout + uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT }} + + - name: Install + uses: ./.github/actions/node + + - name: Setup git config + run: | + git config user.name "kiwicom-orbit-bot" + git config user.email "frontend-platform@kiwi.com" + + - name: Build + run: | + yarn tokens build + yarn tailwind-preset build + yarn components build + + - name: Update Visual Tests + run: | + yarn components test-ct --update-snapshots + git add --all + if git diff-index --quiet HEAD; then + echo "No changes to visual tests" + exit 0 + else + echo "Commiting changes to visual tests" + git commit -m "${{ github.event.inputs.commitMessage || 'chore: update visual tests' }}" + git push origin HEAD + fi