1
0
mirror of synced 2025-12-22 03:16:52 -05:00

[Actions - Reusable workflows] Fix secrets inherit path (#28093)

This commit is contained in:
Ajay
2022-05-30 16:26:22 +09:00
committed by GitHub
parent 36c00a8d19
commit 5ffb9e4ca9
2 changed files with 39 additions and 40 deletions

View File

@@ -157,42 +157,6 @@ jobs:
```
{% endraw %}
{% if actions-inherit-secrets-reusable-workflows %}
#### `on.workflow_call.secrets.inherit`
Use the `inherit` keyword to pass all the calling workflow's secrets to the called workflow. This includes all secrets the calling workflow has access to, namely organization, repository, and environment secrets. The `inherit` keyword can be used to pass secrets across repositories within the same organization, or across organizations within the same enterprise.
#### Example
{% raw %}
```yaml
on:
workflow_dispatch:
jobs:
pass-secrets-to-workflow:
uses: ./.github/workflows/called-workflow.yml
secrets: inherit
```
```yaml
on:
workflow_call:
jobs:
pass-secret-to-action:
runs-on: ubuntu-latest
steps:
- name: Use a repo or org secret from the calling workflow.
run: echo ${{ secrets.CALLING_WORKFLOW_SECRET }}
```
{% endraw %}
{%endif%}
#### `on.workflow_call.secrets.<secret_id>`
A string identifier to associate with the secret.
@@ -219,7 +183,7 @@ A boolean specifying whether the secret must be supplied.
## `env`
A `map` of environment variables that are available to the steps of all jobs in the workflow. You can also set environment variables that are only available to the steps of a single job or to a single step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
A `map` of environment variables that are available to the steps of all jobs in the workflow. You can also set environment variables that are only available to the steps of a single job or to a single step. For more information, see [`jobs.<job_id>.env`](#jobsjob_idenv) and [`jobs.<job_id>.steps[*].env`](#jobsjob_idstepsenv).
Variables in the `env` map cannot be defined in terms of other variables in the map.
@@ -1028,6 +992,42 @@ jobs:
```
{% endraw %}
{% if actions-inherit-secrets-reusable-workflows %}
### `jobs.<job_id>.secrets.inherit`
Use the `inherit` keyword to pass all the calling workflow's secrets to the called workflow. This includes all secrets the calling workflow has access to, namely organization, repository, and environment secrets. The `inherit` keyword can be used to pass secrets across repositories within the same organization, or across organizations within the same enterprise.
#### Example
{% raw %}
```yaml
on:
workflow_dispatch:
jobs:
pass-secrets-to-workflow:
uses: ./.github/workflows/called-workflow.yml
secrets: inherit
```
```yaml
on:
workflow_call:
jobs:
pass-secret-to-action:
runs-on: ubuntu-latest
steps:
- name: Use a repo or org secret from the calling workflow.
run: echo ${{ secrets.CALLING_WORKFLOW_SECRET }}
```
{% endraw %}
{%endif%}
### `jobs.<job_id>.secrets.<secret_id>`
A pair consisting of a string identifier for the secret and the value of the secret. The identifier must match the name of a secret defined by [`on.workflow_call.secrets.<secret_id>`](#onworkflow_callsecretssecret_id) in the called workflow.