From 92284ebee3a32312818476d99ead8686d181b745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=BChringer?= <51900829+puehringer@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:06:48 +0200 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09fddce..0c72d70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,18 @@ -name: build +name: Build repository on: workflow_dispatch: inputs: + run_parallel: + description: 'Run jobs in parallel' + required: false + type: boolean + default: true + self_hosted: + description: 'Run on self-hosted runner' + required: false + type: boolean + default: true playwright: description: 'Run playwright' required: false @@ -10,16 +20,27 @@ on: default: false playwright_spec_param: type: string - description: "Run specific test(s). Example: `landing-page.spec.ts`" + description: 'Run specific playwright test(s) (optional). Example: landing-page.spec.ts' required: false push: + pull_request: + types: [opened, ready_for_review] + pull_request_review: + types: [submitted] jobs: build: + if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }} uses: datavisyn/github-workflows/.github/workflows/build-node-python.yml@main secrets: inherit + # Boolean inputs are tricky in Github Actions. Their default is not honored in non-workflow-dispatch actions, so setting a default on push is tricky: https://stackoverflow.com/a/73495922 + # To get on push true, use !contains(inputs.myInput, 'false') + # To get on push false, use contains(inputs.myInput, 'true') with: + run_parallel: ${{ !contains(inputs.run_parallel, 'false') }} # true except if box is not checked + runs_on: ${{ (!contains(inputs.self_hosted, 'false') && 'self-hosted') || null }} # self-hosted except if box is not checked cypress_enable: false playwright_enable: true - playwright_run_because_flag: ${{ inputs.playwright == true }} + playwright_run_because_flag: ${{ inputs.playwright == true || github.event_name == 'pull_request' || github.event.review.state == 'approved' }} playwright_spec_param: ${{ inputs.playwright_spec_param }} + playwright_runs_on: ${{ (!contains(inputs.self_hosted, 'false') && 'self-hosted') || null }} # self-hosted except if box is not checked