Skip to content

Commit dc9dab0

Browse files
hubwriterlucascostiMartin LopesOctomerger
authored
[GA date TBD] Update reusable workflows docs for GA (#22795)
* Update reusable workflows docs * Update content/actions/learn-github-actions/reusing-workflows.md Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> * Update content/actions/learn-github-actions/reusing-workflows.md * Update content/actions/learn-github-actions/reusing-workflows.md * Update content/actions/learn-github-actions/reusing-workflows.md Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> * Update content/actions/learn-github-actions/reusing-workflows.md Co-authored-by: Martin Lopes <martin389@github.com> * Apply review suggestion from Lucas * Update content/actions/learn-github-actions/reusing-workflows.md Co-authored-by: Martin Lopes <martin389@github.com> * Update content/actions/learn-github-actions/reusing-workflows.md Co-authored-by: Martin Lopes <martin389@github.com> * Update content/actions/learn-github-actions/reusing-workflows.md Co-authored-by: Martin Lopes <martin389@github.com> * Add information about use of runners As per review comment from Ajay Krishna Nalisetty * Update content/actions/learn-github-actions/workflow-syntax-for-github-actions.md Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> * Update content/actions/learn-github-actions/workflow-syntax-for-github-actions.md * Fix version as per Lucas's review comment * Explain using environment secrets * Add workflow diagram * Move explanation of diagram above it * Slight change to job_workflow-ref description Include the syntax of the response data, as per https://github.slack.com/archives/C01SMLA6MNY/p1637731982336700 * Clarify difference between repo and job_workflow_ref Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com> Co-authored-by: Martin Lopes <martin389@github.com> Co-authored-by: Octomerger Bot <63058869+Octomerger@users.noreply.github.com>
1 parent 63e2854 commit dc9dab0

8 files changed

Lines changed: 199 additions & 53 deletions

File tree

70.5 KB
Loading

content/actions/deployment/security-hardening-your-deployments/using-openid-connect-with-reusable-workflows.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ topics:
1818
{% data reusables.actions.enterprise-beta %}
1919
{% data reusables.actions.enterprise-github-hosted-runners %}
2020

21-
{% note %}
22-
23-
**Note:** Reusable workflows are currently in beta and subject to change.
24-
25-
{% endnote %}
26-
2721
## About reusable workflows
2822

2923
Rather than copying and pasting deployment jobs from one workflow to another, you can create a reusable workflow that performs the deployment steps. A reusable workflow can be used by another workflow if it meets one of the access requirements described in "[Reusing workflows](/actions/learn-github-actions/reusing-workflows#access-to-reusable-workflows)."

content/actions/learn-github-actions/reusing-workflows.md

Lines changed: 153 additions & 43 deletions
Large diffs are not rendered by default.

content/actions/learn-github-actions/usage-limits-billing-and-administration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ In addition to the usage limits, you must ensure that you use {% data variables.
6868
{% ifversion fpt or ghes > 3.3 or ghae-issue-4757 or ghec %}
6969
## Billing for reusable workflows
7070

71-
If you reuse a workflow, billing is always associated with the caller workflow. For more information see, "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
71+
If you reuse a workflow, billing is always associated with the caller workflow. Assignment of {% ifversion fpt or ghes or ghec %}{% data variables.product.prodname_dotcom %}-hosted runners{% endif %}{% ifversion ghae %}{% data variables.actions.hosted_runner %}s{% endif %} is always evaluated using only the caller's context. The caller cannot use {% ifversion fpt or ghes or ghec %}{% data variables.product.prodname_dotcom %}-hosted runners{% endif %}{% ifversion ghae %}{% data variables.actions.hosted_runner %}s{% endif %} from the called repository.
72+
73+
For more information see, "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
7274
{% endif %}
7375

7476
## Artifact and log retention policy

content/actions/learn-github-actions/workflow-syntax-for-github-actions.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,31 @@ For more information, see "[Reusing workflows](/actions/learn-github-actions/reu
226226

227227
Required if input is defined for the `on.workflow_call` keyword. The value of this parameter is a string specifying the data type of the input. This must be one of: `boolean`, `number`, or `string`.
228228

229+
## `on.workflow_call.outputs`
230+
231+
A map of outputs for a called workflow. Called workflow outputs are available to all downstream jobs in the caller workflow. Each output has an identifier, an optional `description,` and a `value.` The `value` must be set to the value of an output from a job within the called workflow.
232+
233+
In the example below, two outputs are defined for this reusable workflow: `workflow_output1` and `workflow_output2`. These are mapped to outputs called `job_output1` and `job_output2`, both from a job called `my_job`.
234+
235+
### Example
236+
237+
{% raw %}
238+
```yaml
239+
on:
240+
workflow_call:
241+
# Map the workflow outputs to job outputs
242+
outputs:
243+
workflow_output1:
244+
description: "The first job output"
245+
value: ${{ jobs.my_job.outputs.job_output1 }}
246+
workflow_output2:
247+
description: "The second job output"
248+
value: ${{ jobs.my_job.outputs.job_output2 }}
249+
```
250+
{% endraw %}
251+
252+
For information on how to reference a job output, see [`jobs.<job_id>.outputs`](#jobsjob_idoutputs). For more information, see "[Reusing workflows](/actions/learn-github-actions/reusing-workflows)."
253+
229254
## `on.workflow_call.secrets`
230255

231256
A map of the secrets that can be used in the called workflow.

content/organizations/keeping-your-organization-secure/reviewing-the-audit-log-for-your-organization.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ To search for specific events, use the `action` qualifier in your query. Actions
7777
| [`secret_scanning_new_repos`](#secret_scanning_new_repos-category-actions) | Contains organization-level configuration activities for secret scanning for new repositories created in the organization. {% ifversion fpt or ghec %}
7878
| [`sponsors`](#sponsors-category-actions) | Contains all events related to sponsor buttons (see "[Displaying a sponsor button in your repository](/articles/displaying-a-sponsor-button-in-your-repository)"){% endif %}
7979
| [`team`](#team-category-actions) | Contains all activities related to teams in your organization.
80-
| [`team_discussions`](#team_discussions-category-actions) | Contains activities related to managing team discussions for an organization.
80+
| [`team_discussions`](#team_discussions-category-actions) | Contains activities related to managing team discussions for an organization.{% ifversion fpt or ghec or ghes > 3.1 or ghae-next %}
81+
| [`workflows`](#workflows-category-actions) | Contains activities related to {% data variables.product.prodname_actions %} workflows.{% endif %}
8182

8283
You can search for specific sets of actions using these terms. For example:
8384

@@ -743,10 +744,11 @@ For more information, see "[Managing the publication of {% data variables.produc
743744
| `disable` | Triggered when an organization owner disables team discussions for an organization. For more information, see "[Disabling team discussions for your organization](/articles/disabling-team-discussions-for-your-organization)."
744745
| `enable` | Triggered when an organization owner enables team discussions for an organization.
745746

747+
{% ifversion fpt or ghec or ghes > 3.1 or ghae-next %}
746748
### `workflows` category actions
747749

748750
{% data reusables.actions.actions-audit-events-workflow %}
749-
751+
{% endif %}
750752
## Further reading
751753

752754
- "[Keeping your organization secure](/articles/keeping-your-organization-secure)"{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5146 %}

data/reusables/actions/actions-audit-events-workflow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
| `disable_workflow` | Triggered when a workflow is disabled.
88
| `enable_workflow` | Triggered when a workflow is enabled, after previously being disabled by `disable_workflow`.
99
| `rerun_workflow_run` | Triggered when a workflow run is re-run. For more information, see "[Re-running a workflow](/actions/managing-workflow-runs/re-running-a-workflow)."{% endif %}{% ifversion fpt or ghec or ghes > 3.2 or ghae-issue-4963 %}
10-
| `prepared_workflow_job` | Triggered when a workflow job is started. Includes the list of secrets that were provided to the job. Can only be viewed using the REST API; not visible in the UI or the JSON/CSV export. For more information, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows)."{% endif %}{% ifversion fpt or ghes > 3.1 or ghae-issue-1157 or ghec %}
10+
| `prepared_workflow_job` | Triggered when a workflow job is started. Includes the list of secrets that were provided to the job. Can only be viewed using the REST API. It is not visible in the the {% data variables.product.prodname_dotcom %} web interface or included in the JSON/CSV export. For more information, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows)."{% endif %}{% ifversion fpt or ghes > 3.1 or ghae-issue-1157 or ghec %}
1111
| `approve_workflow_job` | Triggered when a workflow job has been approved. For more information, see "[Reviewing deployments](/actions/managing-workflow-runs/reviewing-deployments)."
1212
| `reject_workflow_job` | Triggered when a workflow job has been rejected. For more information, see "[Reviewing deployments](/actions/managing-workflow-runs/reviewing-deployments)."{% endif %}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
To pass named inputs to a called workflow, use the `with` keyword in a job. Use the `secrets` keyword to pass named secrets. For inputs, the data type of the input value must match the type specified in the called workflow (either boolean, number, or string).
2+
3+
{% raw %}
4+
```yaml
5+
jobs:
6+
call-workflow-passing-data:
7+
uses: octo-org/example-repo/.github/workflows/reusable-workflow.yml@main
8+
with:
9+
username: mona
10+
secrets:
11+
envPAT: ${{ secrets.envPAT }}
12+
```
13+
{% endraw %}

0 commit comments

Comments
 (0)