From db8b284d6f49d96fe65f707c4f1320d71bf899e4 Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Fri, 13 Sep 2024 18:45:23 +0200 Subject: [PATCH] Run playwright tests on pull request as well --- .github/workflows/demo-server-deploy.yml | 4 ++-- .github/workflows/playwright.yml | 5 +++-- rest-api/db/migrations/20240911070907_change_log.sql | 2 +- web-app/src/hooks.server.ts | 3 ++- web-app/src/lib/templates/blog/BlogArticle.svelte | 4 +++- web-app/src/lib/templates/blog/BlogIndex.svelte | 4 +++- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/demo-server-deploy.yml b/.github/workflows/demo-server-deploy.yml index 08d9fda..1d79a3d 100644 --- a/.github/workflows/demo-server-deploy.yml +++ b/.github/workflows/demo-server-deploy.yml @@ -2,8 +2,8 @@ name: Deploy app to demo server (demo.archtika.com) on: workflow_run: - workflows: ['Playwright tests'] - types: [completed] + workflows: [ 'Playwright tests' ] + types: [ completed ] env: SERVER_USER: root SERVER_IP: 128.140.75.240 diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 42f7764..a110f8e 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -2,8 +2,9 @@ name: Playwright tests on: push: - branches: - - main + branches: [ main ] + pull_request: + branches: [ main ] jobs: test: diff --git a/rest-api/db/migrations/20240911070907_change_log.sql b/rest-api/db/migrations/20240911070907_change_log.sql index 30e90ea..27dcb23 100644 --- a/rest-api/db/migrations/20240911070907_change_log.sql +++ b/rest-api/db/migrations/20240911070907_change_log.sql @@ -18,7 +18,7 @@ CREATE FUNCTION internal.track_changes () DECLARE _website_id UUID; BEGIN - IF (to_jsonb (OLD.*) - 'last_modified_at') = (to_jsonb (NEW.*) - 'last_modified_at') OR (to_jsonb (OLD.*) - 'last_modified_by') = (to_jsonb (NEW.*) - 'last_modified_by') THEN + IF (to_jsonb (OLD.*) - 'last_modified_at') = (to_jsonb (NEW.*) - 'last_modified_at') THEN RETURN NEW; END IF; IF TG_TABLE_NAME = 'website' THEN diff --git a/web-app/src/hooks.server.ts b/web-app/src/hooks.server.ts index b30a999..51a677c 100644 --- a/web-app/src/hooks.server.ts +++ b/web-app/src/hooks.server.ts @@ -1,5 +1,6 @@ import { redirect } from "@sveltejs/kit"; import { API_BASE_PREFIX } from "$lib/server/utils"; +import type { User } from "$lib/db-schema"; export const handle = async ({ event, resolve }) => { if (!event.url.pathname.startsWith("/api/")) { @@ -21,7 +22,7 @@ export const handle = async ({ event, resolve }) => { throw redirect(303, "/"); } - const user = await userData.json(); + const user: User = await userData.json(); event.locals.user = user; } diff --git a/web-app/src/lib/templates/blog/BlogArticle.svelte b/web-app/src/lib/templates/blog/BlogArticle.svelte index bd44bac..4a119f5 100644 --- a/web-app/src/lib/templates/blog/BlogArticle.svelte +++ b/web-app/src/lib/templates/blog/BlogArticle.svelte @@ -25,7 +25,9 @@
-

{article.publication_date}

+ {#if article.publication_date} +

{article.publication_date}

+ {/if}

{article.title}

{#if article.cover_image} diff --git a/web-app/src/lib/templates/blog/BlogIndex.svelte b/web-app/src/lib/templates/blog/BlogIndex.svelte index 424aa6f..a0033b2 100644 --- a/web-app/src/lib/templates/blog/BlogIndex.svelte +++ b/web-app/src/lib/templates/blog/BlogIndex.svelte @@ -44,7 +44,9 @@ {#each websiteOverview.article as article} {@const articleFileName = article.title.toLowerCase().split(" ").join("-")}
  • -

    {article.publication_date}

    + {#if article.publication_date} +

    {article.publication_date}

    + {/if}

    {article.title}