You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/learn-github-actions/contexts.md
+42-11Lines changed: 42 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ You can access contexts using the expression syntax. For more information, see "
45
45
|`matrix`|`object`| Contains the matrix properties defined in the workflow that apply to the current job. For more information, see [`matrix` context](#matrix-context). |
46
46
|`needs`|`object`| Contains the outputs of all jobs that are defined as a dependency of the current job. For more information, see [`needs` context](#needs-context). |
47
47
{%- ifversion fpt or ghec or ghes > 3.3 or ghae-issue-4757 %}
48
-
| `inputs` | `object` | Contains the inputs of a reusable workflow. For more information, see [`inputs` context](#inputs-context). |{% endif %}
48
+
| `inputs` | `object` | Contains the inputs of a reusable {% if actions-unified-inputs %}or manually triggered {% endif %}workflow. For more information, see [`inputs` context](#inputs-context). |{% endif %}
49
49
50
50
As part of an expression, you can access context information using one of two syntaxes.
51
51
@@ -714,33 +714,32 @@ jobs:
714
714
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-4757 %}
715
715
## `inputs` context
716
716
717
-
The `inputs` context contains input properties passed to a reusable workflow. Theinput names and types are defined in the [`workflow_call` event configuration](/actions/learn-github-actions/events-that-trigger-workflows#workflow-reuse-events) of a reusable workflow, and the input values are passed from [`jobs.<job_id>.with`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idwith) in an external workflow that calls the reusable workflow.
717
+
The `inputs` context contains input properties passed to a reusable workflow{% if actions-unified-inputs %} or to a manually triggered workflow{% endif %}. {% if actions-unified-inputs %}For reusable workflows, the{% else %}The{% endif %} input names and types are defined in the [`workflow_call` event configuration](/actions/learn-github-actions/events-that-trigger-workflows#workflow-reuse-events) of a reusable workflow, and the input values are passed from [`jobs.<job_id>.with`](/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idwith) in an external workflow that calls the reusable workflow. {% if actions-unified-inputs %}For manually triggered workflows, the inputs are defined in the [`workflow_dispatch` event configuration](/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch) of a workflow.{% endif %}
718
718
719
-
There are no standard properties in the `inputs` context, only those which are defined in the reusable workflow file.
719
+
There are no standard properties in the `inputs` context, only those which are defined in the workflow file.
720
720
721
721
{% data reusables.actions.reusable-workflows-ghes-beta %}
722
722
723
-
For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)".
724
-
725
723
| Property name | Type | Description |
726
724
|---------------|------|-------------|
727
-
|`inputs`|`object`| This context is only available in a [reusable workflow](/actions/learn-github-actions/reusing-workflows). You can access this context from any job or step in a workflow. This object contains the properties listed below. |
725
+
|`inputs`|`object`| This context is only available in a [reusable workflow](/actions/learn-github-actions/reusing-workflows){% if actions-unified-inputs %} or in a workflow triggered by the [`workflow_dispatch` event](/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch){% endif %}. You can access this context from any job or step in a workflow. This object contains the properties listed below. |
728
726
|`inputs.<name>`|`string` or `number` or `boolean`| Each input value passed from an external workflow. |
729
727
730
728
### Example contents of the `inputs` context
731
729
732
-
The following example contents of the `inputs` context is from a job in a reusable workflow that has defined the `build_id`and `deploy_target` inputs.
730
+
The following example contents of the `inputs` context is from a workflow that has defined the `build_id`, `deploy_target`, and `perform_deploy` inputs.
733
731
734
732
```yaml
735
733
{
736
734
"build_id": 123456768,
737
-
"deploy_target": "deployment_sys_1a"
735
+
"deploy_target": "deployment_sys_1a",
736
+
"perform_deploy": true
738
737
}
739
738
```
740
739
741
-
### Example usage of the `inputs` context
740
+
### Example usage of the `inputs` context in a reusable workflow
742
741
743
-
This example reusable workflow uses the `inputs` context to get the values of the `build_id`and `deploy_target` inputs that were passed to the reusable workflow from the caller workflow.
742
+
This example reusable workflow uses the `inputs` context to get the values of the `build_id`, `deploy_target`, and `perform_deploy` inputs that were passed to the reusable workflow from the caller workflow.
### Example usage of the `inputs` context in a manually triggered workflow
772
+
773
+
This example workflow triggered by a `workflow_dispatch` event uses the `inputs` context to get the values of the `build_id`, `deploy_target`, and `perform_deploy` inputs that were passed to the workflow.
Copy file name to clipboardExpand all lines: content/actions/using-workflows/events-that-trigger-workflows.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1250,12 +1250,13 @@ on: workflow_dispatch
1250
1250
1251
1251
#### Providing inputs
1252
1252
1253
-
You can configure custom-defined input properties, default input values, and required inputs for the event directly in your workflow. When you trigger the event, you can provide the `ref` and any `inputs`. When the workflow runs, you can access the input values in the `github.event.inputs` context. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
1253
+
You can configure custom-defined input properties, default input values, and required inputs for the event directly in your workflow. When you trigger the event, you can provide the `ref` and any `inputs`. When the workflow runs, you can access the input values in the {% if actions-unified-inputs %}`inputs`{% else %}`github.event.inputs`{% endif %} context. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
1254
+
1255
+
{% data reusables.actions.inputs-vs-github-event-inputs %}
1254
1256
1255
1257
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %}
1256
-
This example defines inputs called `logLevel`, `tags`, and `environment`. You pass values for these inputs to the workflow when you run it. This workflow then prints the values to the log, using the `github.event.inputs.logLevel`, `github.event.inputs.tags`, and `github.event.inputs.environment` context properties.
1258
+
This example defines inputs called `logLevel`, `tags`, and `environment`. You pass values for these inputs to the workflow when you run it. This workflow then prints the values to the log, using the {% if actions-unified-inputs %}`inputs.logLevel`, `inputs.tags`, and `inputs.environment`{% else %}`github.event.inputs.logLevel`, `github.event.inputs.tags`, and `github.event.inputs.environment`{% endif %} context properties.
For more information, see the {% data variables.product.prodname_cli %} information in "[Manually running a workflow](/actions/managing-workflow-runs/manually-running-a-workflow)."
1307
1307
1308
1308
{% else %}
1309
-
This example defines the `name` and `home` inputs and prints them using the `github.event.inputs.name` and `github.event.inputs.home` contexts. If a `home` isn't provided, the default value 'The Octoverse' is printed.
1309
+
This example defines the `name` and `home` inputs and prints them using the {% if actions-unified-inputs %}`inputs.name` and `inputs.home`{% else %}`github.event.inputs.name` and `github.event.inputs.home`{% endif %} contexts. If a `home` isn't provided, the default value 'The Octoverse' is printed.
1310
1310
1311
1311
```yaml
1312
1312
name: Manually triggered workflow
@@ -1330,8 +1330,8 @@ jobs:
1330
1330
echo Hello $NAME!
1331
1331
echo -in $HOME
1332
1332
env:
1333
-
NAME: {% raw %}${{ github.event.inputs.name }}{% endraw %}
1334
-
HOME: {% raw %}${{ github.event.inputs.home }}{% endraw %}
1333
+
NAME: {% if actions-unified-inputs %}{% raw %}${{ inputs.name }}{% endraw %}{% else %}{% raw %}${{ github.event.inputs.name }}{% endraw %}{% endif %}
1334
+
HOME: {% if actions-unified-inputs %}{% raw %}${{ github.event.inputs.home }}{% endraw %}{% else %}{% raw %}${{ github.event.inputs.home }}{% endraw %}{% endif %}
**Note**: The workflow will also receive the inputs in the `github.event.inputs` context. The information in the `inputs` context and `github.event.inputs` context is identical except that the `inputs` context preserves Boolean values as Booleans instead of converting them to strings.
Copy file name to clipboardExpand all lines: data/reusables/actions/workflow-dispatch-inputs.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
When using the `workflow_dispatch` event, you can optionally specify inputs that are passed to the workflow.
2
2
3
-
The triggered workflow receives the inputs in the `github.event.inputs` context. For more information, see "[Contexts](/actions/learn-github-actions/contexts#github-context)."
3
+
The triggered workflow receives the inputs in the {% if actions-unified-inputs %}`inputs`{% else %}`github.event.inputs`{% endif %} context. For more information, see "[Contexts]({% if actions-unified-inputs %}/actions/learn-github-actions/contexts#inputs-context{% else %}/actions/learn-github-actions/contexts#github-context{% endif %})."
4
+
5
+
{% data reusables.actions.inputs-vs-github-event-inputs %}
if: {% if actions-unified-inputs %}{% raw %} ${{ inputs.print_tags }} {% endraw %}{% else %}{% raw %} ${{ github.event.inputs.print_tags == 'true' }} {% endraw %}{% endif %}
35
37
steps:
36
38
- name: Print the input tag to STDOUT
37
-
run: echo {% raw %} The tags are ${{ github.event.inputs.tags }} {% endraw %}
39
+
run: {% if actions-unified-inputs %}echo {% raw %} The tags are ${{ inputs.tags }} {% endraw %}{% else %}echo {% raw %} The tags are ${{ github.event.inputs.tags }} {% endraw %}{% endif %}
0 commit comments