Merge pull request 'refactor: Update workflow triggers for E2E tests and deployment processes' (#5) from fest/ci-improvement into main
All checks were successful
Run Tests / Lint (push) Successful in 36s
Run Tests / Unit Tests (push) Successful in 42s

Reviewed-on: #5
This commit is contained in:
2025-10-28 13:55:34 +01:00
3 changed files with 7 additions and 9 deletions

View File

@@ -3,14 +3,12 @@ on:
workflow_run: workflow_run:
workflows: workflows:
- Run E2E Tests - Run E2E Tests
branches:
- main
types: types:
- completed - completed
jobs: jobs:
build-and-push: build-and-push:
if: ${{ github.event.workflow_run.conclusion == 'success' }} if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'refs/heads/main')) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
DEFAULT_BRANCH: main DEFAULT_BRANCH: main
@@ -41,6 +39,10 @@ jobs:
sha="${WORKFLOW_RUN_HEAD_SHA}" sha="${WORKFLOW_RUN_HEAD_SHA}"
fi fi
if [[ "$ref_name" == refs/heads/* ]]; then
ref_name="${ref_name#refs/heads/}"
fi
if [ "$ref_name" = "${DEFAULT_BRANCH:-main}" ]; then if [ "$ref_name" = "${DEFAULT_BRANCH:-main}" ]; then
echo "on_default=true" >> "$GITHUB_OUTPUT" echo "on_default=true" >> "$GITHUB_OUTPUT"
else else

View File

@@ -3,14 +3,12 @@ on:
workflow_run: workflow_run:
workflows: workflows:
- Build and Push Docker Image - Build and Push Docker Image
branches:
- main
types: types:
- completed - completed
jobs: jobs:
deploy: deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }} if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'refs/heads/main')) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
DEFAULT_BRANCH: main DEFAULT_BRANCH: main

View File

@@ -4,8 +4,6 @@ on:
workflow_run: workflow_run:
workflows: workflows:
- Run Tests - Run Tests
branches:
- main
types: types:
- completed - completed
workflow_dispatch: workflow_dispatch:
@@ -13,7 +11,7 @@ on:
jobs: jobs:
e2e: e2e:
name: E2E Tests name: E2E Tests
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') }} if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'refs/heads/main')) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright/python:v1.55.0-jammy container: mcr.microsoft.com/playwright/python:v1.55.0-jammy
env: env: