Skip to content

refactor(frontend): reduce code duplication in Menu component #1697

refactor(frontend): reduce code duplication in Menu component

refactor(frontend): reduce code duplication in Menu component #1697

name: Update E2E Snapshots
on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, labeled ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
oisy-backend-wasm:
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-e2e-snapshots') }}
steps:
- name: Checkout
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v4
- name: Checkout for pull request
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GIX_CREATE_PR_PAT }}
- name: Build oisy-backend WASM
uses: ./.github/actions/oisy-backend
update_snapshots:
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-e2e-snapshots') }}
needs: oisy-backend-wasm
steps:
- name: Fail if branch is main
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
run: |
echo "This workflow should not be triggered with workflow_dispatch on main"
exit 1
- name: Checkout
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v4
- name: Checkout for pull request
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GIX_CREATE_PR_PAT }}
- name: Deploy the backend
uses: ./.github/actions/deploy-backend
- name: Prepare
uses: ./.github/actions/prepare
- name: Run Playwright tests
run: npm run e2e:snapshots
- name: Commit Playwright updated snapshots
uses: EndBug/add-and-commit@v9
if: ${{ github.ref != 'refs/heads/main' }}
with:
add: e2e
default_author: github_actions
message: "🤖 Update E2E snapshots"
- name: Stage Changes
if: github.ref == 'refs/heads/main'
run: git add .
- name: Check for Changes
if: github.ref == 'refs/heads/main'
run: |
if ! git diff --cached --quiet; then
echo "CHANGES_DETECTED=true" >> $GITHUB_ENV
MODIFIED_FILES=$(git diff --cached --name-only)
echo "MODIFIED_FILES<<EOF" >> $GITHUB_ENV
echo "$MODIFIED_FILES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
fi
- name: Create Pull Request (if changes and on main)
if: github.ref == 'refs/heads/main' && env.CHANGES_DETECTED == 'true'
uses: ./.github/actions/create-pr
with:
token: ${{ secrets.GIX_CREATE_PR_PAT }}
branch: bot-e2e-update-snapshots
title: 'chore(e2e): Update Playwright E2E Snapshots'
body: |
The following E2E snapshots have been updated:
```
${{ env.MODIFIED_FILES }}