I am trying to figure out how to add to my conditions at the top level. Basically I want to run job-run-all
and job-run-suite
no matter what happens with job-delete-data
. But I need job-delete-data
to run first.
I also only want to run job-run-all
and job-run-suite
with a certain conditional but it seems to always skip them if I use always + my conditional
name: Run Automation On Demand
on:
workflow_dispatch:
inputs:
choice:
type: choice
description: Which suite do you want to run?
options:
- All Tests
- All UI
- All API
- Login
DeleteOldData:
type: boolean
required: false
default: false
jobs:
job-delete-data:
if: ${{ github.event.inputs.DeleteOldData == 'true' }}
run: blah blah
job-run-all:
needs: job-delete-data
if: |
always() &&
${{ github.event.inputs.choice == 'All Tests' }}
runs-on: macos-latest-xlarge
strategy:
matrix:
node-version: [21.x]
steps:
- name: If All Tests, Run All Playwright Tests in Parallel
if: ${{ github.event.inputs.choice == 'All Tests' }}
run: xxxx
job-run-suite:
needs: job-delete-data
if: |
always()
${{ github.event.inputs.choice != 'All Tests' }}
runs-on: macos-latest-xlarge
strategy:
matrix:
node-version: [21.x]
steps:
- name: If Suite Specific, Run Just Selected Suite
if: ${{ github.event.inputs.choice != 'All Tests' && github.event.inputs.choice != 'All UI' && github.event.inputs.choice != 'All API' }}
run: URL=${{ github.event.inputs.URL }} npx playwright test --workers=8 --grep @${{ github.event.inputs.choice }}
I expect that the job job-run-suite
is skipped if my condition is not true but basically it always skips it no matter what