Skip to content

Commit f09f014

Browse files
Clarify environment secret usage with reusable workflows (#52735)
Co-authored-by: Dylan <67774922+heavymachinery@users.noreply.github.com>
1 parent 0dc8df1 commit f09f014

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

content/actions/sharing-automations/reusing-workflows.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ You can define inputs and secrets, which can be passed from the caller workflow
136136
required: true
137137
type: string
138138
secrets:
139-
envPAT:
139+
personal_access_token:
140140
required: true
141141
```
142142

@@ -160,22 +160,22 @@ You can define inputs and secrets, which can be passed from the caller workflow
160160
jobs:
161161
reusable_workflow_job:
162162
runs-on: ubuntu-latest
163-
environment: production
164163
steps:
165164
- uses: actions/labeler@v4
166165
with:
167-
repo-token: ${{ secrets.envPAT }}
166+
repo-token: ${{ secrets.personal_access_token }}
168167
configuration-path: ${{ inputs.config-path }}
169168
```
170169

171170
{% endraw %}
172-
In the example above, `envPAT` is an environment secret that's been added to the `production` environment. This environment is therefore referenced within the job.
173171

174-
{% note %}
172+
In the example above, `personal_access_token` is a secret that's defined at the repository or organization level.
175173

176-
**Note**: Environment secrets are {% ifversion fpt or ghec %}encrypted {% endif %}strings that are stored in an environment that you've defined for a repository. Environment secrets are only available to workflow jobs that reference the appropriate environment. For more information, see "[AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment#environment-secrets)."
174+
{% warning %}
177175

178-
{% endnote %}
176+
**Warning**: Environment secrets cannot be passed from the caller workflow as `on.workflow_call` does not support the `environment` keyword. If you include `environment` in the reusable workflow at the job level, the environment secret will be used, and not the secret passed from the caller workflow. For more information, see "[AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment#environment-secrets)" and "[AUTOTITLE](/actions/writing-workflows/workflow-syntax-for-github-actions#onworkflow_call)".
177+
178+
{% endwarning %}
179179

180180
1. Pass the input or secret from the caller workflow.
181181

@@ -361,7 +361,7 @@ jobs:
361361
workflowB-calls-workflowC:
362362
uses: different-org/example-repo/.github/workflows/C.yml@main
363363
secrets:
364-
envPAT: ${{ secrets.envPAT }} # pass just this secret
364+
repo-token: ${{ secrets.person_access_token }} # pass just this secret
365365
```
366366

367367
{% endraw %}

data/reusables/actions/pass-inputs-to-reusable-workflows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
with:
1010
config-path: .github/labeler.yml
1111
secrets:
12-
envPAT: ${{ secrets.envPAT }}
12+
personal_access_token: ${{ secrets.token }}
1313
```
1414
1515
{% endraw %}

0 commit comments

Comments
 (0)