From df8e4d4bf04bbe4876ad095a1b4df5feddc11cd0 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Tue, 19 Mar 2024 11:03:14 -0700 Subject: [PATCH] chore(ci): run PR tests conditionally (#1885) --- .github/workflows/.tests.yml | 9 +++++++-- .github/workflows/pr-open.yml | 3 +++ .github/workflows/scheduled.yml | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/.tests.yml b/.github/workflows/.tests.yml index 259a7e95d..7779cbd27 100644 --- a/.github/workflows/.tests.yml +++ b/.github/workflows/.tests.yml @@ -3,12 +3,17 @@ name: .Tests on: workflow_call: inputs: - ### Typical / recommended + ### Required target: description: PR number, test or prod + required: true + type: string + + ### Typical / recommended + triggers: + description: Bash array to diff for build triggering; omit to always fire required: false type: string - default: test env: DOMAIN: apps.silver.devops.gov.bc.ca diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 28ac260e2..f082445dc 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -43,8 +43,10 @@ jobs: triggers: ('backend/' 'frontend/' 'migrations/') params: --set global.secrets.persist=false + tests: name: Tests + if: needs.deploys.triggered == 'true' needs: [deploys] uses: ./.github/workflows/.tests.yml with: @@ -52,6 +54,7 @@ jobs: results: name: PR Results + if: always() || !failure() needs: [tests] runs-on: ubuntu-22.04 steps: diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml index 2f447fdb8..f83e1f3a4 100644 --- a/.github/workflows/scheduled.yml +++ b/.github/workflows/scheduled.yml @@ -96,6 +96,8 @@ jobs: tests: name: Tests uses: ./.github/workflows/.tests.yml + with: + target: test zap_scan: runs-on: ubuntu-latest