From 017fe409287daef4fc46cbdce6992e08ec5d64c7 Mon Sep 17 00:00:00 2001 From: Adrian Moldovan <3854374+adimoldovan@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:48:14 +0100 Subject: [PATCH] [testing workflows] Use choices for on-demand test run input (#50170) --- .github/workflows/ci.yml | 2 +- .github/workflows/tests-on-demand.yml | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5aa76b8de2..a7e4bfad4f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ on: type: string concurrency: - group: '${{ github.workflow }}-${{ github.ref }}' + group: '${{ github.workflow }}-${{ github.ref }}-${{ inputs.trigger }}' cancel-in-progress: true env: diff --git a/.github/workflows/tests-on-demand.yml b/.github/workflows/tests-on-demand.yml index 27d0286195f..c558dec65a4 100644 --- a/.github/workflows/tests-on-demand.yml +++ b/.github/workflows/tests-on-demand.yml @@ -4,14 +4,35 @@ on: workflow_dispatch: inputs: trigger: - description: 'Event name. It will be used to filter the jobs to run in ci.yml. It can be anything, as long as the job you want to run has this event configured in the `events` list. Example: daily-checks, pull_request, on-demand, etc.' + type: choice + description: 'Event name: it will be used to filter the jobs to run in ci.yml.' required: true - default: '' + options: + - push + - daily-checks + - pre-release + - on-demand + - custom + default: on-demand + custom-trigger: + type: string + description: 'Custom event name: In case the `Event name` choice is `custom`, this field is required.' + required: false jobs: + validate-input: + runs-on: ubuntu-latest + steps: + - name: 'Validate input' + run: | + if [ "${{ inputs.trigger }}" == "custom" ] && [ -z "${{ inputs.custom-trigger }}" ]; then + echo "Custom event name is required when event name choice `custom`." + exit 1 + fi + run-tests: name: 'Run tests' uses: ./.github/workflows/ci.yml with: - trigger: ${{ inputs.trigger }} + trigger: ${{ inputs.trigger == 'custom' && inputs.custom-trigger || inputs.trigger }} secrets: inherit