[testing workflows] Use choices for on-demand test run input (#50170)

This commit is contained in:
Adrian Moldovan 2024-07-31 18:48:14 +01:00 committed by GitHub
parent d3bd80fc61
commit 017fe40928
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 4 deletions

View File

@ -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:

View File

@ -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