Co-authored-by: Peter Bengtsson <mail@peterbe.com> Co-authored-by: Matt Pollard <mattpollard@users.noreply.github.com>
41 lines
1.7 KiB
Markdown
41 lines
1.7 KiB
Markdown
When using the `workflow_dispatch` event, you can optionally specify inputs that are passed to the workflow.
|
|
|
|
The triggered workflow receives the inputs in the {% ifversion actions-unified-inputs %}`inputs`{% else %}`github.event.inputs`{% endif %} context. For more information, see "[Contexts]({% ifversion actions-unified-inputs %}/actions/learn-github-actions/contexts#inputs-context{% else %}/actions/learn-github-actions/contexts#github-context{% endif %})."
|
|
|
|
{% data reusables.actions.inputs-vs-github-event-inputs %}
|
|
|
|
```yaml
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
logLevel:
|
|
description: 'Log level'
|
|
required: true
|
|
default: 'warning' {% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
|
type: choice
|
|
options:
|
|
- info
|
|
- warning
|
|
- debug {% endif %}
|
|
print_tags:
|
|
description: 'True to print to STDOUT'
|
|
required: true {% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
|
type: boolean {% endif %}
|
|
tags:
|
|
description: 'Test scenario tags'
|
|
required: true {% ifversion fpt or ghec or ghes > 3.3 or ghae > 3.3 %}
|
|
type: string
|
|
environment:
|
|
description: 'Environment to run tests against'
|
|
type: environment
|
|
required: true {% endif %}
|
|
|
|
jobs:
|
|
print-tag:
|
|
runs-on: ubuntu-latest
|
|
if: {% ifversion actions-unified-inputs %}{% raw %} ${{ inputs.print_tags }} {% endraw %}{% else %}{% raw %} ${{ github.event.inputs.print_tags == 'true' }} {% endraw %}{% endif %}
|
|
steps:
|
|
- name: Print the input tag to STDOUT
|
|
run: {% ifversion actions-unified-inputs %}echo {% raw %} The tags are ${{ inputs.tags }} {% endraw %}{% else %}echo {% raw %} The tags are ${{ github.event.inputs.tags }} {% endraw %}{% endif %}
|
|
```
|